/*
 * Copyright (c) 2012-2020 MIRACL UK Ltd.
 *
 * This file is part of MIRACL Core
 * (see https://github.com/miracl/core).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* Fixed Data in ROM - Field and Curve parameters */

var ROM_CURVE_ANSSI,
    ROM_CURVE_BLS12383,
    ROM_CURVE_BLS24479,
    ROM_CURVE_BLS48556,
    ROM_CURVE_BLS48286,
	ROM_CURVE_BLS48581,
    ROM_CURVE_BLS12381,
    ROM_CURVE_BLS12461,
	ROM_CURVE_BN462,
    ROM_CURVE_FP256BN,
    ROM_CURVE_FP512BN,
    ROM_CURVE_BN254,
    ROM_CURVE_BN254CX,
    ROM_CURVE_BRAINPOOL,
    ROM_CURVE_C25519,
    ROM_CURVE_C41417,
    ROM_CURVE_C1174,
    ROM_CURVE_C1665,
    ROM_CURVE_MDC,
    ROM_CURVE_ED25519,
    ROM_CURVE_GOLDILOCKS,
    ROM_CURVE_X448,
    ROM_CURVE_HIFIVE,
    ROM_CURVE_NIST256,
    ROM_CURVE_NIST384,
    ROM_CURVE_NIST521,
    ROM_CURVE_NUMS256E,
    ROM_CURVE_NUMS256W,
    ROM_CURVE_NUMS384E,
    ROM_CURVE_NUMS384W,
    ROM_CURVE_NUMS512E,
    ROM_CURVE_NUMS512W,
    ROM_CURVE_SECP256K1,
    ROM_CURVE_SECP160R1,
	ROM_CURVE_SM2,
    ROM_CURVE_C13318,
    ROM_CURVE_JUBJUB,
    ROM_CURVE_TWEEDLEDUM,
    ROM_CURVE_TWEEDLEDEE;
 
ROM_CURVE_ANSSI = function() {

    var ROM_CURVE_ANSSI = {

        // ANSSI curve

        CURVE_Cof_I: 1,
        CURVE_B_I: 0,
        CURVE_B: [0x7BB73F, 0xED967B, 0x803075, 0xE4B1A1, 0xEC0C9A, 0xC00FDF, 0x754A44, 0xD4ABA, 0x28A930, 0x3FCA54, 0xEE35],
        CURVE_Order: [0xD655E1, 0xD459C6, 0x941FFD, 0x40D2BF, 0xDC67E1, 0x435B53, 0xE8CE42, 0x10126D, 0x3AD58F, 0x178C0B, 0xF1FD],
        CURVE_Gx: [0x8F5CFF, 0x7A2DD9, 0x164C9, 0xAF98B7, 0x27D2DC, 0x23958C, 0x4749D4, 0x31183D, 0xC139EB, 0xD4C356, 0xB6B3],
        CURVE_Gy: [0x62CFB, 0x5A1554, 0xE18311, 0xE8E4C9, 0x1C307, 0xEF8C27, 0xF0F3EC, 0x1F9271, 0xB20491, 0xE0F7C8, 0x6142],
        CURVE_HTPC: [0xA725D0,0x983E21,0x349EA8,0xBB477B,0x4C66D2,0x5676B5,0x119A09,0xAC6DC7,0x18A3AC,0x6D4DFD,0x7290],
    };
    return ROM_CURVE_ANSSI;
};

ROM_CURVE_BLS12383 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS12383 = {

        // BLS12383 Curve
        // Base Bits= 23

        CURVE_Cof_I: 0,
        CURVE_B_I: 15,
        CURVE_B: [0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x3C0001, 0x33D7FD, 0x5CEC82, 0x9069C, 0x5F095A, 0x703BC0, 0x5A62C, 0x2200E4, 0x3809C0, 0x1801, 0x8006, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gx: [0x734573, 0x6E7210, 0x11E311, 0x1FA3B8, 0x5DBF08, 0x688B8A, 0x12BC78, 0x43DD6C, 0x742C2F, 0x6D6103, 0x4C767D, 0x6D8287, 0x74052D, 0x1C706B, 0x5E7B39, 0x5D2ADC, 0x41FC],
        CURVE_Gy: [0x3F224, 0x2CBD00, 0x7484B4, 0x43FCC7, 0x7D49EC, 0x25BBCA, 0x2B7AD3, 0x29854A, 0x449107, 0xCD76C, 0x7436B7, 0x6236CC, 0x1CDC31, 0x495D, 0x33ECC0, 0xB393A, 0x68F],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x1200, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
		CURVE_Cof: [0x11FF, 0x2, 0x40020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        //CURVE_Cof: [0x169EAB, 0x2AC2AA, 0x7ED541, 0x555DF, 0x2AAC00, 0xAAB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxa: [0x7F2D86, 0x676C5A, 0x7850F2, 0x4AE8E9, 0x7DAB67, 0x65DD03, 0x3D5895, 0x3F8E48, 0x725BD4, 0x10A5AA, 0xC9407, 0xF3A32, 0x967CB, 0x180F32, 0x7B00FA, 0x691203, 0x634],
        CURVE_Pxb: [0x52DE15, 0x483D88, 0x37BF67, 0x2BFF30, 0x4AB28D, 0x3AEB6A, 0x23A4B5, 0x6CC5D4, 0x4C89DF, 0x5B3A0B, 0x13D263, 0x1B0EE9, 0x717288, 0x5E6F4E, 0x592E, 0x3C0030, 0x300D],
        CURVE_Pya: [0x8CB41, 0x617728, 0x5971A3, 0x106B0C, 0x1EDE4F, 0x5CEB69, 0x2A44E8, 0x4BC1D6, 0x1B3E68, 0x2CE793, 0x3A643B, 0x31A3DB, 0x573FE, 0x79293B, 0x4894D1, 0x167C9E, 0x3379],
        CURVE_Pyb: [0x479093, 0xC86FE, 0x18EB61, 0x731124, 0x43CB0D, 0x131602, 0x127DEF, 0x78597A, 0x7A8F7A, 0x8D67D, 0x73835, 0x53D700, 0x3A7D15, 0x649DCF, 0x33631A, 0x123EE9, 0x20E5],
 
        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: true,

        //debug: false,

    };

    return ROM_CURVE_BLS12383;
};


ROM_CURVE_BLS24479 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS24479 = {

        // BLS24479 Curve
        // Base Bits= 23
        CURVE_Cof_I: 0,
        CURVE_B_I: 19,
        CURVE_B: [0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1, 0x11FFE0, 0x464068, 0x1FFAA8, 0x71E703, 0x645BB5, 0x379FB8, 0x689D35, 0x49D0CE, 0x49091F, 0x4A7308, 0x286C0B, 0x3B44A0, 0x60B731, 0x6807C3, 0x8002, 0x10010, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gx: [0x63CCD4, 0x41EBD7, 0x15919D, 0x576CFA, 0x1EFE2D, 0x743F98, 0xFC23A, 0x409A3C, 0x595AF8, 0x6F8DF1, 0x38B611, 0x65468D, 0x7E4BFD, 0x6B0D9D, 0x7641D, 0x2ECCDE, 0xB7FEA, 0x5BD3C3, 0x2BE521, 0x71A0BE, 0x1AB2B],
        CURVE_Gy: [0x1E5245, 0x4B95A4, 0x5B132E, 0x462AEF, 0x36D660, 0x672E8D, 0x7B4A53, 0x79E459, 0x24920F, 0x4828B0, 0x58F969, 0x1D527E, 0x4E00F6, 0x457EF3, 0x66924A, 0x294FFB, 0x66A7A4, 0x70C394, 0x4F91DE, 0x386362, 0x47FCB],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x11FF80, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
		CURVE_Cof: [0x11FF7F, 0x400, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        //CURVE_Cof: [0x7415AB, 0x7F7FF3, 0x5FFF07, 0x2AB555, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxaa: [0x624678, 0x26A6E9, 0x22F8A, 0x212C12, 0x60C343, 0x3DF8D3, 0x5D9733, 0x6BFC87, 0x2D2888, 0x758675, 0x259D1C, 0x7E922C, 0x4BAB37, 0x11DAAB, 0x6214A4, 0x758A55, 0x786671, 0x72B190, 0x32581D, 0x729D1F, 0x959D],
        CURVE_Pxab: [0x3099B8, 0x3D75FF, 0x40E1FE, 0x9523, 0x63775A, 0x78470A, 0x5746C7, 0x7CF1B5, 0x26A730, 0x14FE14, 0x76CA97, 0x61C7C2, 0x669261, 0x6A7C2F, 0x3E5DA9, 0x5F2D68, 0x2D39D1, 0x4A3C98, 0x4CF7F1, 0x68418B, 0x3B0DE],
        CURVE_Pxba: [0x2D15D3, 0x1BCE23, 0x5BB687, 0x46FB70, 0x185317, 0x47C134, 0x2FD0FA, 0x3597B2, 0x56DE56, 0x165B19, 0x1D3F6E, 0x10E136, 0x76B1EF, 0x1913C7, 0x4011EF, 0x1F994F, 0x3FE210, 0x545186, 0x41EBCA, 0x7D6A72, 0x3EC27],
        CURVE_Pxbb: [0x60F480, 0x650EBD, 0x2E31EA, 0x21EB62, 0x14556E, 0x1C3973, 0x48B7E0, 0xFFEFD, 0x50122F, 0x55EE1F, 0x263BD7, 0x2ED92B, 0x1BA3AD, 0x39C35E, 0x2DD201, 0x17232E, 0x1DA7CE, 0x4CB0AA, 0x1E67DF, 0x46DE50, 0xA5B3],
        CURVE_Pyaa: [0x781AA0, 0x132628, 0x2AC619, 0x181DB8, 0x3609DA, 0x3F8897, 0x4A9851, 0x189252, 0x4C42A, 0x768C5C, 0x66B9A2, 0x1C1D70, 0x4FCADC, 0x69ED7C, 0x7D286C, 0xD685, 0x198F9, 0x459DA0, 0x30250D, 0x1AEB9B, 0x5057F],
        CURVE_Pyab: [0x2E08FA, 0x58AFDD, 0x5AB6EF, 0x5D52FC, 0x78774, 0x348594, 0x32BC26, 0x23C32, 0x3BCCF7, 0xB913F, 0x3E1549, 0x5B907F, 0x77B3E6, 0x22C6ED, 0x7865FE, 0x3DAEFB, 0x60F558, 0x702D7A, 0x3A258D, 0x24B30F, 0x2CE2B],
        CURVE_Pyba: [0x70CC41, 0x4ED4B, 0x7D5CC, 0x2A9855, 0x7F8932, 0x5F1428, 0x7361E6, 0x14406C, 0x68A9FE, 0x21DCA7, 0x4DC54E, 0x10783E, 0x71F3A4, 0x3AA336, 0x6C5305, 0x1E5ADC, 0x1A39DD, 0x7C73F0, 0x18C69A, 0x2331F7, 0x18070],
        CURVE_Pybb: [0x5C1CAE, 0x65CCA2, 0x2373C6, 0x2AD84C, 0x2D40D3, 0x714EEE, 0x10FF70, 0x3AE561, 0x136B6, 0x3EBA67, 0x75CBF3, 0x327450, 0x161AC1, 0x5CB9A1, 0x2C42EE, 0x48BB8F, 0x56D046, 0x725081, 0x77B22D, 0x2756CD, 0x499D1],
 
        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: true,

        //debug: false,
    };

    return ROM_CURVE_BLS24479;
};

ROM_CURVE_BLS48581 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS48581 = {

// Base Bits= 23
// Ate Bits= 33
// G2 Table size= 36

		CURVE_Cof_I: 0,
		CURVE_Cof: [0x382,0x280,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_B_I: 1,
		CURVE_B: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_Order: [0x671C01,0x7CDF9A,0x46297,0x3E126D,0x659946,0x789997,0x1588C0,0x2E3E68,0x2016A8,0x698992,0x65A74,0x17373A,0x3C972C,0x7F5AD,0x4F2F80,0x3D1F85,0x463538,0x2B81AD,0x733058,0x7119D4,0x5E2885,0x5F1524,0x8E1,0x0,0x0,0x0],
		CURVE_Gx: [0x5AF640,0xE6462,0x30EF3A,0x50F36C,0x4DA5D3,0x70D96E,0x5A2C45,0x62BED9,0x36EBDB,0x3B0B24,0x611D99,0x37CB22,0x46A9DF,0x8AA0A,0x6E7DD5,0x5D76FF,0x761ABD,0xD0D19,0x15F83A,0x6F1F9,0x693F86,0x6E7BE3,0x4AEBCA,0x561A07,0x2F59B7,0x5],
		CURVE_Gy: [0x587A70,0x3BC7C4,0x5DB6ED,0x5C935A,0x37AEF7,0x65C6BE,0x21DB46,0x3FBBE1,0x722F48,0x30987D,0x3D9E1,0x7729F4,0x7FB98A,0x776F7D,0x5C83BD,0x4EEA0D,0x699127,0x5714A5,0x4F27BF,0x24452A,0x7B398A,0x6745A3,0x647E1A,0x7B298F,0x6FDA44,0x19],
        CURVE_HTPC: [0x1193EC,0x617C06,0x10CE4F,0x203AC1,0x288964,0x28C418,0x2A39C3,0x76DF25,0x6FD560,0x4F7AAB,0x41C1AC,0x25F766,0x24A962,0x2766C2,0x1AB5F1,0x2AF131,0x30C7,0x308B53,0xB0B77,0x5A7353,0x429389,0x3153FA,0x653C17,0x2EE2D7,0x2348CD,0x12],

		CURVE_Bnx: [0x381,0x280,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_Pxaaa: [0x68BFAB,0x216959,0x7B0D3F,0x110AA6,0x797663,0x2062F6,0x1247D4,0x26C0,0x400503,0x40C25E,0x698F2,0x462114,0x3AAD1A,0xDFEF3,0x3C55B1,0x6D9D17,0x37DE64,0x9B799,0x3F1C0D,0x75D5DF,0x22775D,0x6FF48B,0x128E08,0x53C38F,0x5615D9,0xB],
		CURVE_Pxaab: [0x347C57,0x66CCED,0x7C59A6,0x57D0A1,0x556A01,0x1FFAEA,0x65E58C,0x63B186,0x4F0C3,0x7F4C4A,0x529DAB,0x6F8B10,0xABFE,0x72874,0x1FD387,0x6D0918,0x1526F6,0x42C47D,0x5B6603,0x45915D,0x2BC07E,0x361D0D,0x14481A,0x67112C,0x44973E,0xF],
		CURVE_Pxaba: [0x5A3E6A,0x2AD94A,0x519220,0x359F85,0x74CDED,0x3FD51D,0x6E1E75,0x465EFD,0x555F02,0x61A54D,0x6B9D9B,0x49217F,0x41DBD1,0xC02C3,0x2D6ADA,0x2BE65D,0x7A6D69,0x446F94,0x1B2A6B,0x639D45,0x3AD83B,0x5D430A,0x4D386C,0xCC789,0x7CCC70,0x3],
		CURVE_Pxabb: [0x7FEAFE,0x67976,0x7C269C,0x7405E1,0xB8CB4,0x14A462,0x5F0803,0x18E292,0x39468C,0x6364F3,0x3B050E,0x63BB73,0x5F63E1,0x43152,0x62F833,0x151C9F,0x21B7B9,0x5E7CB0,0x616B18,0x7F47AC,0x154D4B,0x1B0025,0x6171E,0x12E75B,0x62218C,0x17],
		CURVE_Pxbaa: [0x78CCE5,0x7438A7,0x6DCE70,0x64EA65,0x35F746,0x5018CB,0x6226A,0x56AAFE,0x9274F,0x1255CB,0x42CBBD,0x4EAD60,0x1E4819,0x33303F,0x14E19A,0x73E2C0,0x675FF0,0x2C856A,0x1D742C,0x1803E3,0x2A9DD6,0x331C99,0x44E8F1,0x59AC,0xB91C6,0x7],
		CURVE_Pxbab: [0x3C093A,0x1B2294,0x43C801,0x7E719B,0x160910,0x12FF8F,0x5D84BC,0x2D4F8B,0x5DD759,0x738162,0x55ED02,0x44CBF5,0x3835D2,0x303BEC,0xDD060,0x33BDD8,0x3D1A58,0x612EF4,0x4D773B,0x47BDC7,0x6CDA08,0x2623C9,0x6180FC,0x3F5839,0x16C779,0x19],
		CURVE_Pxbba: [0x50E057,0xFCC0E,0x539058,0x2E19A,0x35B0E2,0x2C6669,0x49308B,0xE5F21,0x432AAD,0x3DF9E6,0x7432A9,0x1E7687,0x7293B1,0x39DE23,0x2DE912,0x45D160,0x36DB90,0x2270A5,0x106CE7,0x3306F5,0x108AEE,0x2F4931,0x38FC06,0x63030F,0x1B7951,0x17],
		CURVE_Pxbbb: [0x46AE34,0x3401F7,0x613867,0x74BE1F,0x2F2FC9,0x89CAD,0x3AFE7F,0x3CDEB5,0x545854,0x6FC561,0x29C642,0x67F9B2,0x293F29,0x3F19F9,0x4A29FE,0x20B8CB,0x211CF7,0x5E8F6A,0x6A77BE,0x58F2EB,0x74AAA2,0x4C4989,0x7B14A0,0x17D95E,0x27D5C2,0x10],
		CURVE_Pyaaa: [0x2D7971,0x27FC9A,0x4C8FB7,0x9607F,0x5012AB,0x2CB208,0x5FBA9B,0x4CD5FB,0x163C15,0x5B15CA,0x43DCCD,0x3BA46C,0x35AFA2,0x6120C4,0xD7EAA,0x4F5FE2,0x66F3B3,0x334AEF,0x508E01,0x25C8C5,0x52F302,0x2E42C8,0x577E92,0x361BAD,0x6B5335,0x1],
		CURVE_Pyaab: [0x4D5665,0x3B726D,0x44451C,0x2FFE3D,0x342352,0x45CB11,0x5F5D83,0x97D04,0x4E1DD2,0x125564,0x170F46,0xF8C96,0x6B243B,0x75F612,0x4BF2FC,0x14B239,0x3A01D7,0x64BCDF,0x108AE8,0x615BAD,0x15FCAD,0x4CA630,0x7C5136,0x4BCF07,0x4DC75,0x5],
		CURVE_Pyaba: [0x2A8474,0x54A4D4,0x79A0CC,0x61DC7E,0x47C46F,0x44D397,0x546994,0x60E9AE,0x65E2F0,0x14652B,0x4554DB,0x48208A,0x499D0E,0x6BEFAB,0x414511,0x24069B,0x119D3A,0x42DAB6,0x7140C0,0x779617,0x367669,0x3DF6E0,0x48F908,0x6E8042,0x36A201,0x16],
		CURVE_Pyabb: [0x41589D,0x7B5250,0x4C5884,0xF299B,0x3D8B8A,0x4AF1F6,0x40FB97,0x33DED2,0xBA10D,0x6E84EE,0x3B4A05,0x7D206E,0x224333,0x59136,0x48B49D,0x738870,0x3DD8B0,0x1B9DC4,0x7B4CD8,0x58E166,0x478762,0x47F77A,0x1A208,0x310F6E,0x6C25A4,0x15],
		CURVE_Pybaa: [0x650137,0x63F305,0xFD1E0,0x7E7BD2,0x57FDDD,0x6F6110,0x651744,0x21809A,0x64F59F,0x1CA256,0x78B29,0x66E745,0x7FA238,0x5B0B8E,0x4A615F,0x402F88,0x35A959,0x7BB27,0x71506D,0x512AA6,0x288325,0x207F4B,0x11A459,0x111D4E,0x209D5A,0x1A],
		CURVE_Pybab: [0x10BEE4,0x38B19F,0x1653BB,0x13679D,0x59ED82,0x6CF3B4,0x32A9CA,0x57E0CC,0x139E3A,0x78301A,0x2093D1,0x420FB,0xE8C27,0x750684,0x2DD413,0x7102AD,0x589D82,0x2CE456,0x359BAC,0x48210D,0x2D537B,0x2673AB,0x5E944F,0x22B9B5,0x50D037,0xF],
		CURVE_Pybba: [0x323986,0x75D5FD,0x2CF507,0x6CD531,0x84017,0x39993D,0xE7D4F,0x5A07D3,0x618B5B,0x18E964,0x307EAE,0x432791,0x5AE3A2,0x731E84,0x669B7,0xA7264,0x64155F,0x108360,0x4D93F0,0x450037,0x5D17AF,0x5A0BBF,0x7A8970,0x8DF32,0x167678,0x11],
		CURVE_Pybbb: [0x2718B6,0x7F96E6,0x57599F,0x2034E2,0x2C66E8,0x6E91CB,0x12ACCF,0x1806C6,0x205417,0x7D8E32,0x6B40CC,0xF4BF0,0xE69C3,0x26747F,0x32A6A5,0x5B77C7,0x487549,0x7D1CA1,0x3C501A,0x5AF034,0x4F981,0x4B80FD,0x274E4E,0x7FC481,0x5E2524,0x6],
//		CURVE_W: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],
//		CURVE_SB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]],
//		CURVE_WB: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],
//		CURVE_BB: [[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,


    };

    return ROM_CURVE_BLS48581;
};


ROM_CURVE_BN462 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BN462 = {
// Base Bits= 23
// Ate Bits= 118
// G2 Table size= 125

		CURVE_Cof_I: 1,
		CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_B_I: 5,
		CURVE_B: [0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_Order: [0x10800D,0x600FC0,0x9006,0x0,0x7F7C00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2],
		CURVE_Gx: [0x36980D,0x323E6D,0x44F263,0x2E6B80,0x40372E,0x4F2473,0x5A82C7,0x734D20,0x31BBB4,0x5CD13B,0xF3D2C,0x1F6DF6,0x15F63B,0x4C96DF,0x2E6B24,0x5180B0,0x3A34A0,0x323F5B,0x7BC940,0xD36B3,0x2],
		CURVE_Gy: [0x7B03DE,0x669A6D,0x2AA295,0x31176,0x2C6660,0x68EA86,0x3AE03,0xDC572,0x777DF1,0x4DCD5,0x165941,0x6BC463,0x4CCFA7,0x5B5085,0x29243B,0x353A19,0x2B3367,0x6F5770,0x1183DF,0x8C750,0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

		CURVE_Bnx: [0x7FBFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x4001FF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_Pxa: [0x61E4DF,0x7B2695,0x551A38,0x4403B4,0x26A8B4,0x5C3E15,0x3800CA,0x4DD6C9,0x1AD269,0x10411F,0x4E0810,0x6B0E48,0x1CD96E,0x66FCF8,0x520B80,0x465EE2,0x338E3A,0x3B41BF,0x216D63,0x12BE66,0x0],
		CURVE_Pxb: [0xCD283,0x174D55,0x6DCC42,0x742874,0x359BF7,0x6A15F1,0x60DC63,0x72AADB,0x5D86BA,0x630269,0x210162,0x6C8BB4,0x730CBE,0x4546A8,0x68F263,0x24AB35,0xEDCA8,0x22055F,0xFA166,0x69721A,0x1],
		CURVE_Pya: [0x37154E,0x51BE1B,0x5DB96D,0xEBE19,0x40E7B1,0x6D2B42,0x38CB80,0xE4EED,0x19A1F4,0x21E27,0x6D0BFA,0x7D3D35,0x6E23C3,0x2C68E0,0x7B280D,0x510404,0x517427,0x5832F2,0xE7688,0x503282,0x0],
		CURVE_Pyb: [0x22A93A,0x18AA59,0x7AE853,0x1A49DC,0xD5374,0x70F54D,0x13BE1C,0x122250,0x464769,0x7AE4B9,0x6ACDC3,0x59C9F8,0x69AC57,0x3CD618,0x135135,0x398319,0x2C8AE3,0x17C02E,0x2F50E3,0x39F786,0x0],
		CURVE_W: [[0x20003,0xC0,0x0,0x0,0x7FF000,0x7E7FEF,0x7FFFFF,0x7FFFFF,0x17FFFF,0x400C00,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],
		CURVE_SB: [[[0x28004,0xC0,0x0,0x0,0x7FEC00,0x7E7FEE,0x7FFFFF,0x7FFFFF,0x17FFFF,0x400C00,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x11000E,0x600FC0,0x9006,0x0,0x7F7800,0xF7EE1,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2]],[[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x20003,0xC0,0x0,0x0,0x7FF000,0x7E7FEF,0x7FFFFF,0x7FFFFF,0x17FFFF,0x400C00,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]],
		CURVE_WB: [[0x4000,0x40,0x0,0x0,0x3FFE00,0x7F7FFB,0x7FFFFF,0x7FFFFF,0x7FFFF,0x400400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7ABFFB,0x1FFC7F,0x7FFFFF,0x7FFFFF,0x4029FF,0x100042,0x240,0x0,0x100000,0x7F7FFF,0x7DBFD4,0x7FFFFF,0x7FFFFF,0x4800BF,0x401200,0x1,0x0,0x0,0x0,0x0,0x0],[0x7D3FFD,0x4FFE3F,0x7FFFFF,0x7FFFFF,0x4015FF,0x80021,0x120,0x0,0x480000,0x3FBFFF,0x7EDFEA,0x7FFFFF,0x7FFFFF,0x24005F,0x600900,0x0,0x0,0x0,0x0,0x0,0x0],[0xC001,0x40,0x0,0x0,0x3FFA00,0x7F7FFA,0x7FFFFF,0x7FFFFF,0x7FFFF,0x400400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],
		CURVE_BB: [[[0x7FC000,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x4001FF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7FBFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x4001FF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7FBFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x4001FF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x11000F,0x600FC0,0x9006,0x0,0x7F7800,0xF7EE1,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2]],[[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x10C00E,0x600FC0,0x9006,0x0,0x3F7A00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2],[0x10C00D,0x600FC0,0x9006,0x0,0x3F7A00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2],[0x10C00E,0x600FC0,0x9006,0x0,0x3F7A00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2]],[[0x7F7FFE,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7F7FFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x10C00F,0x600FC0,0x9006,0x0,0x3F7A00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2],[0x11800F,0x600FC0,0x9006,0x0,0x7F7400,0xF7EE0,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2],[0x7F7FFD,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x10C00F,0x600FC0,0x9006,0x0,0x3F7A00,0xF7EE2,0x3FD9BF,0x7FFFFB,0x77FFFF,0x438403,0x4A423B,0x6C0,0x0,0x37F940,0x3DADF6,0x7B7F86,0x7FFFFF,0x47FFF,0x580480,0x202401,0x2]]],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,


    };

    return ROM_CURVE_BN462;
};


ROM_CURVE_BLS48556 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS48556 = {

        // BLS48556 Curve
        // Base Bits= 23
        CURVE_Cof_I: 0,
        CURVE_B_I: 17,
        CURVE_B: [0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1, 0x7E0000, 0x421BFF, 0x714ED3, 0x455409, 0x53842, 0x7AC588, 0x7E8A68, 0xAD8C1, 0x184DA5, 0x7FB5E2, 0x5E936, 0x5EF479, 0x12B881, 0x46FE3F, 0x32FD85, 0x2973C4, 0x3D260D, 0x318DF1, 0x88D57, 0x3F73EA, 0x1887, 0x0, 0x0, 0x0],
        CURVE_Gx: [0x571D33, 0x5A5ECB, 0x3FCA1, 0x7F196F, 0x580554, 0x23DC17, 0x591DC, 0x1987F8, 0x7CA7F6, 0x345E03, 0x203D9A, 0x1734D, 0x444E07, 0x5602B2, 0x5003E, 0x5961D5, 0x30D242, 0x336BC2, 0x79241, 0xE0499, 0x7EDD74, 0x3B712A, 0x215D65, 0x544F49, 0x9],
        CURVE_Gy: [0x6ED83A, 0x367FD4, 0x33DA69, 0x254538, 0x5C4B95, 0x2B0CEF, 0x7AA39A, 0x47D9C8, 0x677B5F, 0x4F9E3D, 0x6DC8A6, 0x71C0C7, 0x4B44E2, 0x4AA8F1, 0x4C3099, 0x3071E3, 0x240862, 0x1B9CCF, 0x579C4, 0x4D1997, 0x3349DA, 0x3F5C56, 0x5318B1, 0x56C684, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x640020, 0xFB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
		CURVE_Cof: [0x64001F, 0xFB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        //CURVE_Cof: [0x12ABEB, 0x221EFE, 0x528B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Pxaaa: [0x23CE4A, 0x5D1D12, 0x74AA34, 0x695C09, 0x3D7102, 0x274419, 0x76284C, 0x69F0B2, 0x4637C1, 0x5FE3FE, 0x242E62, 0x3F853E, 0x4DD2B3, 0x672BDE, 0x6ED92, 0x2B9BAD, 0x6C4ABF, 0x393882, 0x32EE21, 0x2EF3A1, 0x59487E, 0x92F4B, 0x26870, 0x32BC6C, 0xE],
        CURVE_Pxaab: [0xA1BE1, 0x1B8B58, 0x7DC9C7, 0x3BEB, 0x28FE3B, 0x72E58B, 0x51E10C, 0x31856A, 0x389247, 0x15B9FD, 0x2847EA, 0x2E35A0, 0x9B0E7, 0x7F92CE, 0x6960C8, 0xC5821, 0x48632D, 0xC919C, 0x3C27F4, 0x2A934D, 0x348B6E, 0x2F6B1B, 0x179D2A, 0x4A1009, 0x2],
        CURVE_Pxaba: [0xC5DC4, 0x6498EE, 0x4B68E9, 0x6ED677, 0x2964AD, 0x7D8E6D, 0x4D0966, 0x550884, 0x1926AC, 0x47162D, 0x633555, 0x265962, 0x6402B8, 0x48F745, 0x68195F, 0x198B3A, 0x117CE2, 0x5E9EFB, 0x729335, 0x471F6E, 0x3689BA, 0x3BB4F1, 0x3DDB5C, 0x297F7C, 0xB],
        CURVE_Pxabb: [0x64B740, 0x52CD34, 0x578358, 0x464902, 0x11FD49, 0x475BA2, 0x5C150C, 0x436206, 0x335E27, 0x7CFA66, 0x53BA9F, 0x39E20F, 0x41E3C, 0x30CB43, 0x5E7D7A, 0x4869DA, 0x6B405, 0x57B683, 0x77306A, 0x3E774A, 0x63B1A6, 0x4BE47E, 0x764B7F, 0x1C2054, 0x9],
        CURVE_Pxbaa: [0x71E01F, 0x18C2E5, 0x26EC, 0x1A5853, 0x4311CD, 0x430F11, 0x43E8E4, 0x20204C, 0x35AB89, 0x775C07, 0x43202C, 0x442943, 0x1E3472, 0xB1BEA, 0x14841D, 0x56A6A1, 0x4E27C3, 0x6AC397, 0x111E6A, 0x453F3C, 0x449D32, 0x6288F9, 0x7D0633, 0x6F0F7B, 0xD],
        CURVE_Pxbab: [0x37383D, 0x70470C, 0x66C28, 0x7CCC3F, 0x220253, 0x27A425, 0x147B57, 0x64A9AE, 0x7A0147, 0x61CE2B, 0x7620BF, 0x1CEB9B, 0x3F1646, 0x5546DC, 0x12AEC8, 0x2A6D46, 0x38885E, 0xA7FD0, 0x3A2974, 0x7872F1, 0x4F91FB, 0x2ADE02, 0x632141, 0x16D9D3, 0x8],
        CURVE_Pxbba: [0x11939C, 0x7B67AE, 0x6BA5A0, 0x34D20C, 0x1BE51D, 0x65ED81, 0x6D5CB3, 0x6465E6, 0x40B384, 0x146E44, 0x54F471, 0x119F79, 0x11A9B3, 0x5235B8, 0x342402, 0x6B0380, 0x51A403, 0x22E30F, 0x1F23BA, 0x468CDF, 0x5A9CCF, 0x77C486, 0x613650, 0x411539, 0xA],
        CURVE_Pxbbb: [0x6F4899, 0x2150A, 0x750CB5, 0x4952B2, 0x1C51EB, 0x179378, 0x295E64, 0x5B5457, 0x47A789, 0x1403F8, 0x62578C, 0x2F5D38, 0x7FE82C, 0x6CFF62, 0x32162, 0x3ACBE5, 0x1E3000, 0x668F, 0x426A4B, 0x4F46ED, 0x57A328, 0x62ACF0, 0xF705B, 0x7BAA3C, 0xD],
        CURVE_Pyaaa: [0x137844, 0x2F9F68, 0x4DDB82, 0x4FFA79, 0x44EC64, 0x6D10A3, 0x1BEAF1, 0x4B2F5C, 0xB8A71, 0x20AB1C, 0x225B80, 0x663E7C, 0x673C10, 0x7E8EA9, 0x2FC388, 0x66E9CC, 0x202F56, 0x39587C, 0x343E8C, 0x52C8BF, 0x6190B, 0x11FB0E, 0x6124D5, 0x337685, 0x7],
        CURVE_Pyaab: [0x483190, 0x6491DB, 0x424978, 0x23544C, 0x2EAAF4, 0x31A65, 0x48EEB1, 0x7EEB0E, 0x91F2F, 0x2D992C, 0xF07C, 0x4AE56F, 0x688ED2, 0x62E3A0, 0x284758, 0x15CF7, 0x7E205E, 0x9FA40, 0x24EA65, 0xCE87C, 0x7A1C42, 0x1C4D1D, 0x4F76AA, 0x3CE59C, 0x2],
        CURVE_Pyaba: [0x185C0D, 0x3FA083, 0xFA771, 0x50C8EE, 0xD404D, 0x759D3, 0x697D52, 0x6598BC, 0x685C7C, 0x612D58, 0x160D06, 0x2201F3, 0x5C797C, 0x10C374, 0xE7E1C, 0x52FA00, 0x1F60B0, 0x42B24, 0x7635E0, 0xDD262, 0x140D61, 0x26A7E6, 0x595FBC, 0x22CDE4, 0xD],
        CURVE_Pyabb: [0x1D42F8, 0x41502B, 0x5D7DBF, 0x88B12, 0x243AFD, 0x3CFE57, 0x4EC3FA, 0x2FB013, 0x7C3CFF, 0x1D3717, 0x79401A, 0x33C434, 0x635F37, 0x29E4F6, 0x2CA2DB, 0x7A8EF0, 0x3FD902, 0x3309C9, 0x1F125B, 0x3FF0C9, 0x7310, 0x3137DB, 0x280E0B, 0x70755, 0xA],
        CURVE_Pybaa: [0x38039F, 0x25673E, 0x184354, 0x3E78D1, 0xEE895, 0x1279F, 0x285016, 0x445C85, 0x4BFE85, 0x7F8597, 0x2AEDD5, 0x2E62F9, 0x32710C, 0x4F5B51, 0x59016C, 0x6178C7, 0x6E268E, 0x2D39EF, 0x2C36B6, 0x717762, 0x1D1ABC, 0x323714, 0x7C7BB9, 0x582324, 0x2],
        CURVE_Pybab: [0x5F7865, 0x40DE52, 0x20E9A7, 0x7439D3, 0x3F0756, 0x595BAF, 0x7CFC76, 0x287B18, 0x56074E, 0x186679, 0x416EC0, 0x1DC812, 0x127FBE, 0x18D9B5, 0x3C4A9D, 0x1C2BB4, 0x135CA4, 0x7A40AC, 0x739984, 0x6F008C, 0x7180EA, 0x58AF6D, 0x5B4B02, 0x9194C, 0x3],
        CURVE_Pybba: [0x4C1979, 0x753ECF, 0x6F0760, 0x3BB13C, 0x4AAF9C, 0x6BFB52, 0x470858, 0x41323D, 0x5401D8, 0x494404, 0x5CCF5C, 0xBCF06, 0x7E6ECF, 0x5A9C20, 0xD2DFF, 0x64FF44, 0x31645B, 0x4EE883, 0x4E22EC, 0x112445, 0x486C5C, 0x5C8211, 0x67DA66, 0x400692, 0xC],
        CURVE_Pybbb: [0x49F25B, 0x12AC5F, 0x5D33F2, 0x35D356, 0x2C4F80, 0x3A4C9E, 0x3C5A72, 0x426C74, 0x5DAC92, 0x52C146, 0x61366B, 0x6CDE77, 0x5A9E8F, 0x6DFF70, 0x6D20E3, 0x5A60E6, 0x33DF1A, 0x2AFA7, 0x390F0, 0x6320A2, 0x3F5493, 0x1CC373, 0x174990, 0x7B09B, 0xA],
 
        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: true,

        //debug: false,


    };

    return ROM_CURVE_BLS48556;
};


ROM_CURVE_BLS48286 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS48286 = {

        // BLS48286 Curve
        // Base Bits= 23
        CURVE_Cof_I: 62958,
        CURVE_Cof: [0xF5EE,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 10,
        CURVE_B: [0xA,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0x612C81,0x2365FA,0x7FF10,0x1794B8,0xF2882,0x1FC453,0x253EF9,0x359315,0x7C9EDE,0x602A6B,0x1AF27A,0x4,0x0],
        CURVE_Gx: [0x5D59E0,0x7D4612,0x577225,0x677DD0,0x597475,0x9A33B,0x50693A,0x602A23,0x6C0F04,0x11F68E,0x44836E,0x39219E,0x69],
        CURVE_Gy: [0x2BEB43,0x53F2E1,0xBBBBD,0x2C071F,0x37CE6B,0x1583E4,0x7B94EC,0x519846,0x7F979A,0x5AF112,0x7995B8,0x472050,0x203],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0xF5EF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Pxaaa: [0x6106B5,0x46930A,0x3FA105,0x662660,0x43B1CE,0x3EA359,0x6B2BF6,0x3D4A96,0x4CAEB,0x2544F6,0x4C71C7,0x67EA02,0x22A],
        CURVE_Pxaab: [0x6D1A55,0x237B12,0x6A77B3,0x29C48E,0x277185,0x6AD728,0x164BFB,0x264519,0xC873E,0x4B1A4A,0x2D7216,0x5DCCCB,0x18D],
        CURVE_Pxaba: [0x57A35E,0x3474CF,0xE204,0x662C53,0x7AF4E8,0x5E8393,0x41AD4A,0x6E0CD2,0x3DE1D4,0x62F5C5,0x7829F0,0x1496AE,0xA8],
        CURVE_Pxabb: [0x7023E8,0xA4185,0x428A3A,0x799E96,0x191B5C,0x45B13E,0x3D77ED,0xF392E,0x1F92E8,0x1B1776,0x7EB253,0x5F06AA,0x202],
        CURVE_Pxbaa: [0x14CB9B,0x1AB71E,0x3622E6,0x7F12AA,0x217D62,0x72D443,0x5B5546,0x3E38F7,0x225964,0x45096A,0x78FDD,0x139B4D,0x175],
        CURVE_Pxbab: [0x60DD54,0x650D96,0x10EFDA,0x1B8D12,0x532B9,0x7D3817,0x535F9A,0x6B1C6A,0x2D3760,0x668D88,0x7A7567,0xF5242,0x110],
        CURVE_Pxbba: [0x5776DA,0x361573,0x7E8829,0x9089A,0x657276,0x5B5754,0x162F92,0x26F20A,0xE4AAD,0x3F9DEC,0x187F90,0x37E71,0xF6],
        CURVE_Pxbbb: [0x350A8E,0x447051,0x2D7CFF,0x1304E7,0x7554EF,0x5934AE,0x648E87,0x139670,0x68C000,0x2CD8A2,0x483465,0x598734,0x1F0],
        CURVE_Pyaaa: [0x6988BE,0x2BFACF,0x3B89B3,0x74BC5E,0x7E5EF8,0x1D1663,0x1513C5,0x781CD9,0x38694F,0x2AF8FE,0x258B35,0x7C66D,0x21F],
        CURVE_Pyaab: [0x711B92,0x2CDA1B,0x21DE1,0xF5E2F,0x333180,0x681970,0x4A7C36,0xDC200,0x5E1586,0x528744,0x1BFB5E,0xE0FF6,0xE0],
        CURVE_Pyaba: [0x7DD06A,0x74CF57,0x4951F3,0x467F2C,0x3CDAB0,0x571CC9,0x2A634B,0x12AD70,0x335EFF,0x45B3D7,0xF5AFA,0x7FDC6,0x12C],
        CURVE_Pyabb: [0xA47F4,0x3FA6F1,0x4A2CF7,0x308359,0x15F9A3,0x62AFA3,0x4E1447,0x1A5942,0x5D352B,0x743BB7,0x6F7FFC,0x418F2A,0x156],
        CURVE_Pybaa: [0x639E77,0x36E68B,0x132DBB,0x7CA9C6,0x48190F,0x232649,0x37BC94,0x6FB23E,0x74193E,0x569EBD,0x6213,0x472055,0x73],
        CURVE_Pybab: [0x4975C6,0x50286C,0x2C0CA0,0x654460,0x624AD9,0x26E477,0x436B98,0x50CB4D,0x369BE1,0x7238A0,0x25B890,0x2C3B34,0x136],
        CURVE_Pybba: [0x3F2D7C,0x735783,0x102F4C,0x59D512,0x713EF1,0x6FE36,0x2674E,0x5B0A2D,0x288F81,0xBDC69,0x450F27,0x541BA,0x1FB],
        
        CURVE_Pybbb: [0x1130A6,0x41A3CA,0x76AAA6,0x1B12A9,0x39E708,0xD0FDD,0x59DA9F,0x76D23,0x32D633,0x342EEF,0x1AB27A,0x79BC6E,0x193],
        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,


    };

    return ROM_CURVE_BLS48286;
};


ROM_CURVE_BLS12381 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS12381 = {

        // BLS12381 Curve
        // Base Bits= 23

        CURVE_Cof_I: 0,
        CURVE_B_I: 4,
        CURVE_B: [0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1, 0x7FFE00, 0x7BFFFF, 0x7FF2DF, 0x5A402F, 0xAA77, 0x26876, 0x1CEC04, 0x7D4833, 0x26533A, 0x4FB69D, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gx: [0x22C6BB, 0x6015B6, 0x3FECEB, 0x4BD0D7, 0x5E83FF, 0xB0D8A, 0x45C6EB, 0x271D1F, 0x3905A1, 0x1F2EE9, 0xDA231, 0x4D607E, 0x38C4FA, 0x4D2AC, 0x65F5E5, 0x69D398, 0x17F1],
        CURVE_Gy: [0x45E7E1, 0x46528D, 0x1032A8, 0x144457, 0x4C744A, 0x7DBA07, 0x4B012C, 0x6D8C65, 0xAF600, 0x2BABA0, 0x73D782, 0x6C5727, 0xED741, 0x3413C6, 0x6AA83C, 0x7A40F1, 0x8B3],
        CURVE_HTPC: [0x6821B8,0x20C57B,0x6DF314,0x72E2BF,0x69520E,0x621116,0x500FF0,0x376DEE,0x9FF04,0x69291A,0x4BC077,0x38DED0,0x4A9A3D,0x1B671E,0x5B2FDD,0x231645,0x1F7],

        CURVE_Bnx: [0x10000, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
		CURVE_Cof: [0x10001, 0x0, 0x34804, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        //CURVE_Cof: [0xAAAB, 0x555600, 0x5A3002, 0x2AAF0A, 0x48C005, 0x72D, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxa: [0x21BDB8, 0x2D9182, 0x3F5201, 0x402DDF, 0x40326A, 0x2EE175, 0x1EB8F4, 0x2885B2, 0x3B02B4, 0x29F480, 0x1B91EB, 0x28828E, 0x5272DC, 0x24C100, 0x23C2A4, 0x515978, 0x24A],
        CURVE_Pxb: [0x42B7E, 0x7A0ABA, 0x5F96B1, 0x1CA2EA, 0x4F1121, 0x92669, 0x771FD4, 0x6D30DD, 0x361AB5, 0x213241, 0x65AF43, 0x3A7B2A, 0x3A0882, 0xFB59A, 0x1C67D8, 0x15B029, 0x13E0],
        CURVE_Pya: [0x382801, 0x290C11, 0x27864D, 0x5D6514, 0x2C9CC3, 0x259247, 0x545834, 0x214D34, 0x53A76D, 0x55197B, 0x37F66E, 0x71A8D5, 0x5C6DA2, 0x319939, 0x1F5B84, 0x6A93B9, 0xCE5],
        CURVE_Pyb: [0x5F79BE, 0xEBFE0, 0x6AAA4, 0x6760ED, 0x70D275, 0x3567E6, 0x55CBA6, 0x3A4955, 0x63AF26, 0x7D0B4E, 0x2CF8A1, 0x145CCE, 0x2B02BC, 0x6559A, 0x29CD33, 0x625017, 0x606],
 
        CURVE_HTPC2: [0x78492B,0x627501,0x51F09D,0x7754D1,0x45087,0x32E477,0x7532DB,0x4F9B0E,0x5735F4,0x5C4EA3,0x7EB54D,0x6735A4,0x48C21E,0x7203AC,0x1E011,0x4C45CE,0x52],
        CURVE_Ad: [0x584C1D,0x50105A,0x7D73D0,0x707CB,0x36F8DA,0x359312,0x3BF620,0x744C0D,0x66A8D8,0x2707DC,0x43AA61,0x6A4C15,0x202C96,0x67AD27,0x6E3A50,0x234C51,0x14],
        CURVE_Bd: [0x172BE0,0x11D31C,0x174731,0xB6755,0x3215A3,0x5EAB44,0x73BCD7,0x5CE0A7,0x4070A0,0x61E49E,0x5B07,0x7771D9,0x2E8753,0x3162,0x5A200C,0x484688,0x12E2],
        PC: [[0x22D229,0x745D17,0x7EA722,0x3269C8,0x31B80B,0x6D1849,0x70931A,0x605F8D,0x37BC23,0x7C4590,0x475E75,0x6F71E9,0x62381E,0x17A3D2,0x9839C,0x461247,0x6E0],[0x5FB7B,0x3E7E2C,0x33299F,0x6142EF,0x3771F8,0xCDED3,0xEC52,0x579B0,0x7F96D5,0x3BCCF0,0x69F733,0x32D86F,0x409D25,0x4E5B1D,0x7381F8,0xED03C,0x1032],[0x390C9E,0x20CF7C,0x65FC90,0x60193B,0x10B2ED,0x6FF463,0x3D2EC6,0x318A5D,0x5C9967,0x7418,0x74BB2E,0x1C7916,0x7515D1,0x5C186,0x73E9F1,0xFC70D,0x169B],[0x17E317,0x30D509,0x55B5C6,0x35BA74,0x295F29,0x3BC9F4,0x4A3174,0x62CB64,0x5574A2,0x59CF3E,0x10EDD5,0x74C86E,0x33563B,0xF7216,0x69E3F1,0x1E78FC,0x80D],[0x70C88E,0x2C31C7,0x3E732D,0x47A3AD,0x7C8F8C,0x266736,0x3C3C9D,0x416317,0x4DB1A6,0x564EB6,0x55B796,0xBF299,0x84D11,0x5D0E87,0x6AF6F8,0xF3B80,0x17B8],[0x39ED84,0x644B42,0x2B775F,0x82976,0x25128C,0x6551B4,0x3E721A,0x4710C,0xCE190,0x4C9E1F,0x445618,0x3295FD,0x6C38AE,0x2D46E4,0x79134A,0x6B2A9F,0xD6E],[0x652983,0x38CDE,0x67344F,0x5739E8,0x70D2DC,0x721410,0x25F9A3,0x69D5C8,0x799B9E,0x7BB2A4,0x6CF2C5,0x3A55AE,0x1BF7A,0x603A24,0x5CC4FF,0x619286,0x1630],[0x895D9,0x19D359,0x114455,0xF3BE,0x2286F3,0x3130B,0x660BEB,0x3775B2,0x7B3F08,0x3424AF,0x676E65,0xC72A4,0x4B3E41,0x6CC856,0x667D10,0x393518,0xE99],[0x1B6861,0x10C83B,0x4F16CE,0x18838C,0x6E25CE,0x106A66,0x7C6CCC,0x599944,0x3F25F1,0x4AD51B,0x5FD791,0x2AA096,0x1D307E,0x69C0C1,0x731B6D,0x738B37,0x1778],[0x1EDCB0,0x3F3B59,0x7F805E,0x504B94,0x43E3D2,0x4B92B1,0x7B1A38,0x3C7280,0x3E568,0x6652B3,0x380C91,0x54D0DE,0xC5D10,0x3A209,0x5D9E3B,0x2EDC,0xD54],[0x4B83BB,0x5DE367,0x5BA0D3,0x18C61A,0xF2A6F,0xD6907,0x1C347A,0x32F19E,0x417F5,0x365ED5,0x705F9D,0x3D40E3,0x2B2214,0x60B117,0x50EACB,0x2769F4,0x1729],[0x4649B7,0x2CC4E6,0x3ABAB0,0x17316B,0xC2D5F,0x590AC2,0x336D38,0x313DAB,0x5FF2,0x1145AE,0x2CC0FA,0x40AC2B,0x1DD99,0x170122,0x20CCD0,0x2F958F,0x11A0],[0x6CDD0A,0x9A2D1,0xB58E,0x5BC328,0x74E4B4,0x2B262,0x5E3CC7,0x6FA99C,0x503776,0x5D2DEF,0x5A0AD3,0x2B3407,0x63EB3A,0x8EDAD,0x7A4AB5,0x609D5C,0x95F],[0x21D641,0x5874F3,0x411DDB,0x5DD21B,0x26692A,0x6A070,0x1FCE62,0x806D3,0x366B74,0x3AE2C2,0x1FE34,0x3D1E67,0x33DAFC,0x4BD241,0x6953E0,0x767B56,0xA10],[0x4C5A5E,0x33377B,0x4C47DF,0x688F16,0x5B9489,0xB01F4,0x7E608B,0x4B70E6,0x68A819,0x43794,0x39FD8F,0x780CCB,0x5B074C,0x46167E,0x592A2C,0x56154E,0x14A7],[0x684A3A,0x6892DD,0x33B095,0x786F03,0x3B3538,0x539D4E,0x18ABB7,0x170398,0x21894E,0x335EA7,0x5C3D5E,0x4B390A,0x463E05,0x21E7C1,0x5A4D86,0x655678,0x772],[0x6304A5,0x73453E,0x4700B7,0x211478,0xD24BC,0x5EE80,0x492E26,0x21DE77,0x2D4D0A,0x539D39,0x655CD7,0x363749,0x77F050,0x2AA721,0x3999EE,0x2AFC72,0xE73],[0x32A21E,0x72B66A,0x754E74,0x79ABC0,0x29BA81,0x5B537A,0xCECC1,0x35A274,0x62BB8D,0x334240,0x7F7F1D,0x3D03EF,0x55F43E,0x14DE3,0xA452A,0x70B101,0x13A8],[0x462CD8,0x51271B,0x104C37,0x7767AE,0x6D5243,0x7A092E,0x70A35B,0x665455,0x655154,0x7E2D62,0x6C2090,0x75AA2,0x7EF7C4,0x590755,0x62B8BF,0x2AC0D2,0x342],[0x383E19,0x7374B9,0x73F308,0x64A7F6,0x3D0967,0x559AD4,0x2C46B3,0x532700,0xCD1FC,0x5EB4E3,0x3E2505,0x14C8FB,0x629BFF,0x5026FC,0x68C897,0x317F2B,0xB29],[0x2B3BFF,0x4EDD90,0x279720,0x658137,0x2A8846,0x6AE27B,0x23122F,0x13612C,0xC01,0x1419E1,0x4107A3,0x29B1B3,0x11298E,0x69168E,0x556710,0xD2EF5,0x1256],[0x521B1C,0x73F481,0x6264F3,0x71A1EF,0xD681B,0xC56AB,0x5FF22B,0x4AC430,0x48BA9C,0x1746B6,0x757BD,0x1FD378,0x62F4BD,0x43165C,0x3FC66B,0x46AA46,0x8CA],[0x48B604,0x2D7CD3,0x5C12D1,0x7600E3,0x5027EF,0x3656CC,0x256BC0,0x56EA7D,0x5A3957,0x1F092C,0x2C6076,0x7975AE,0x33B42D,0x49D4A1,0x43C0F3,0x5F274C,0x15E6],[0x75224B,0x3CE2A8,0x5E19AC,0x2BCD7D,0x1049B6,0x1C8D74,0x4E5A9F,0x5587AE,0x6568D9,0x3AFD0,0x799CF6,0x251FE2,0x1F748C,0x20542B,0x1133C4,0x14B22F,0x5C1],[0x180133,0x27EBB7,0x110B67,0x611953,0x790AD1,0x3398D9,0x4F1019,0x733196,0x158013,0x101A98,0x55ECEC,0x18AEE3,0xAE7BE,0x6E5F80,0x47B2A6,0x51CA56,0x245],[0x171EF8,0x9E017,0x483530,0xC908F,0x51C19,0x67E0D9,0x1ED18,0x138874,0x308EC0,0x54684D,0x6A9EC4,0x29FA23,0x16004F,0x3A2AA1,0x6E4E6,0x165608,0xB18],[0x74D8E,0x1149A0,0x1B381F,0x5A26B0,0x1CDF41,0x6493B,0x6447D9,0x35FF3F,0x42462E,0x7155E1,0x48D566,0x176E62,0x143FED,0x572318,0x4DBDB7,0x354847,0x18B4],[0x11C132,0x6235A0,0x73A04D,0x71FDD7,0x73A5CC,0x420637,0x58E279,0xC1F20,0x493FD1,0x16D95E,0x34BF2F,0x1FDC9E,0x38F1D4,0x41BFA1,0x5F346F,0x1F23C9,0x1971],[0x731C30,0x55D794,0x3CAEBE,0x6A75D3,0x77055D,0x77367,0x347935,0x4C2F3F,0x76FE06,0x4F22B5,0x10A832,0xA511E,0x5E7ADA,0x244757,0x61AF6D,0x5D3D08,0xE1B],[0x5BA587,0x1CAEF7,0xD80DC,0x3C303D,0x65201C,0x57CD3A,0x7C832,0x45B735,0x426C1E,0x2CCF3B,0x3CEAF4,0x6D0DDC,0x6221E4,0x7D1193,0x659A12,0x200C5E,0x9FC],[0x70FB29,0x194630,0x568579,0x76FF49,0x64550F,0x4C85E,0x309B21,0x1C6D3,0x581FFD,0x7FC77B,0x5C2816,0x3633A0,0x6BD2CA,0x7BD324,0x4EAE1B,0x646A99,0x987],[0x69D6F2,0x710ABF,0x7B2587,0x307A0A,0x7AC24,0x66E8F5,0x1358D3,0x18A09E,0x4CB52,0x1457C3,0x1D6EE3,0x4B59E7,0x7D0277,0x16592E,0x6B06EF,0x5CDE7,0x4AB],[0x33A5F0,0x75626C,0x4A66C8,0x4AD403,0x76326C,0x9C407,0x4EB555,0x282E1E,0x37BD76,0x295F5B,0x529F43,0x53503,0x11DB8F,0x44423C,0x18D2DA,0x1FE520,0x1660],[0x68FEDB,0x35D9E5,0x2106DB,0x4C8205,0x7F8DC0,0x5B85DC,0x84D46,0x419FE9,0x50B879,0x77C79C,0x6554DB,0x294E20,0x7E2A21,0x6B95E9,0x783FC4,0x1FEF7,0x8CC],[0x65F4CB,0x38EF61,0x3298D5,0x7630EF,0x5ABA9,0x1F3BC8,0xC947,0x7251F6,0x791C09,0x721DD6,0x50AA9E,0x233ABE,0x51AD87,0x2F130E,0x260708,0x31BB74,0x1F8],[0x2DE1F6,0x44818E,0xEE37F,0x458029,0x552162,0x34FA4D,0x645003,0x225F25,0x1CE2C3,0x2CB146,0x154B8B,0x5A4CA1,0x4C86A3,0x5E9470,0x259B99,0x3C35D5,0xCC],[0x41C696,0x4EB45C,0x7F825F,0x317D45,0x567119,0x269AD8,0x7AD9EB,0x4831A1,0x383D0F,0x584A9E,0x488FA5,0x5A3418,0x6D776F,0x3AA206,0x3B9604,0x4B5082,0x1349],[0x7BB33,0xAE32E,0xAFA61,0x59DD1E,0x47AEE9,0x7A79A1,0x255950,0x2957B6,0x69522B,0x1C9150,0x46B44E,0x6E7D0,0x709498,0x4B3A3,0x6893B8,0x4BE40D,0x90D],[0x634B8F,0xE743A,0x11055,0x9A4BC,0x2F570F,0x440B94,0xD5B2A,0x277E6B,0x385332,0x4BC4E7,0x47103D,0x40CE0B,0x55E0D7,0x4D6484,0x37700F,0x50EC0B,0xE0F],[0x6D06F7,0x38264D,0x347EB,0x38A664,0x517BD8,0x1C840,0x1E5092,0x3A46F9,0x27C1CB,0x29CE52,0x7D596E,0x6BB795,0x50D53C,0x6C517B,0x4B93CE,0x20075,0x266],[0x3345CC,0x6270AE,0x47A66,0x1DC856,0x763E,0x70D260,0x680366,0x2E777C,0x2267D,0x3315BE,0x50CD1B,0x78A4B2,0x144B45,0x786C26,0x1D9FF8,0x5CA8A6,0xAD6],[0x561092,0x6A53C4,0x2A5A12,0x7BF5DF,0x168986,0x26A2DF,0x33A9E4,0x7CD44,0x42D28C,0x15DF9C,0x7E53FE,0x28623B,0x41E48C,0x7EB0A5,0x740CF,0x5DB3A4,0xACC],[0xF6AA8,0x693975,0x1003E2,0x7C1830,0x5C29F4,0x390E34,0x398DA9,0x2C8D9B,0x26290E,0x7376C3,0x71B740,0x1488EC,0xA01AD,0x291E02,0x29016F,0x792CF7,0x4D2],[0x113F55,0x691771,0x78D1BB,0x294D9A,0x5EA3D,0x1F78E7,0x1FA9F5,0x42C97,0x7BB53,0x47C27B,0x485BDD,0x542481,0x597D94,0x1D5040,0x429B87,0x2AE6D3,0x167A],[0x535D4A,0x7B3AAA,0xDAC8C,0x5C9244,0x7E2F7B,0x690A59,0x12FCE6,0x62BA86,0x5920AB,0x498D5E,0x67EC33,0x3A6627,0x54FD1D,0x63437C,0x5B1848,0x647699,0x1866],[0x12ED9,0x2B42B,0x1183B9,0x400EF7,0xF5B00,0x265724,0x18D5C,0x59A7E9,0x4FD7FE,0x3DF43E,0x1690DD,0x37FB77,0x5FABBA,0x40779B,0xFA9FA,0x77845F,0x16A3],[0x6A775C,0x273224,0x64F468,0x2C58FD,0x29C01A,0xA3ABF,0x100280,0x69B2DE,0x78EF5D,0x751A19,0x7BB3F7,0x4C125A,0x734ACE,0x787750,0x2676CB,0x3E045,0x1660],[0x79B7AC,0xEFF55,0x80B19,0x7D4E67,0x38DB9D,0x4C893E,0x5BC3D6,0x766C3D,0x5881C5,0xCAAA1,0x5C054B,0x418C15,0x6EAAC7,0x33F64C,0x61B6CB,0x7294B8,0x8D9],[0x25001D,0x284623,0x3768E4,0x7E976F,0x315DC0,0x22D441,0x7277B2,0x176D07,0x3BB054,0x3E1ED3,0x1B4672,0x146EE6,0x112F82,0x160199,0x17D0F9,0x703CAA,0xBE0],[0x5F5416,0x5B3088,0x36A349,0x1414BD,0x364F2C,0x682E4E,0x79C9AB,0x1ED244,0x530E12,0x37BB79,0x445717,0x6DA68E,0x3BF89E,0x3E41A4,0x6394E5,0x69443C,0x16B7],[0x3F67F2,0x716A7B,0x247894,0x37CB7C,0x57CD63,0x5D94CE,0x49E734,0x1AD2EE,0x7F310C,0x2AA35C,0x631215,0x758ABB,0x67D6E8,0x6DF555,0x103689,0x799833,0x58D],[0x49A03D,0x20585C,0x54CBD8,0x1A94F1,0x426076,0x3EF14,0x3D14F8,0x5081AB,0x559CA4,0x6E6389,0x17213F,0x1A45C4,0x56C43C,0x434197,0x604807,0x6BAE11,0x1962],[0x3663C1,0x24A760,0x34051E,0x306103,0x3688EF,0x4F40FE,0x56F9CB,0x619195,0xBE6EE,0x4AF130,0x69B7,0x7574B,0x140FAD,0x4A4302,0x27262C,0x16261D,0x1611]],
        CURVE_Adr: [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Adi: [0xF0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Bdr: [0x3F4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Bdi: [0x3F4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        PCR: [[0x2A5ED1,0x555555,0x46238A,0x7B38E3,0xE38D0,0x2EAE13,0x450AE1,0x6B0847,0x10AA22,0x4FE9D0,0x2C52D3,0x7DB0A6,0x2691F5,0x5DADBD,0xE333E,0x32A0FD,0x171D],[0x7FC71E,0x7FFFFF,0x549AA7,0x5C6AAA,0x2AAA9C,0x3028E,0x53C829,0x104635,0xC7F9A,0x5BEF5C,0x613E1E,0x3E447C,0x7CED78,0x6424D,0x6AA66F,0x5F8BD,0x1156],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x2A97D6,0x555555,0x7188E2,0x1ECE38,0x638E34,0x2BAB84,0x7142B8,0x5AC211,0x42A88,0x73FA74,0x4B14B4,0x3F6C29,0x29A47D,0x576B6F,0x238CCF,0x2CA83F,0x5C7],[0xC,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x718B10,0x638E38,0x6786CD,0x36E25E,0x1097A5,0xA49CF,0x26A89D,0x74BBE3,0x6286B0,0x6F43C4,0x586C3C,0x8D683,0x43DE38,0x7F7EE0,0x5B3DE6,0x4D6A1D,0x124C],[0x7FC71C,0x7FFFFF,0x549AA7,0x5C6AAA,0x2AAA9C,0x3028E,0x53C829,0x104635,0xC7F9A,0x5BEF5C,0x613E1E,0x3E447C,0x7CED78,0x6424D,0x6AA66F,0x5F8BD,0x1156],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x46D706,0xE38E3,0x204B3F,0x46497B,0x425EBF,0x201F91,0x1F49F9,0x221CEC,0x649BF5,0x2940FE,0x3DF697,0x688C98,0x18B076,0x6B3498,0x2D044E,0x23BE3D,0x1530],[0x12,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7FA8FB,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01]],
        PCI: [[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7FE38D,0x7FFFFF,0x2A4D53,0x2E3555,0x15554E,0x418147,0x69E414,0x8231A,0x63FCD,0x2DF7AE,0x309F0F,0x1F223E,0x7E76BC,0x432126,0x755337,0x2FC5E,0x8AB],[0x7FC71A,0x7FFFFF,0x549AA7,0x5C6AAA,0x2AAA9C,0x3028E,0x53C829,0x104635,0xC7F9A,0x5BEF5C,0x613E1E,0x3E447C,0x7CED78,0x6424D,0x6AA66F,0x5F8BD,0x1156],[0x2A97D6,0x555555,0x7188E2,0x1ECE38,0x638E34,0x2BAB84,0x7142B8,0x5AC211,0x42A88,0x73FA74,0x4B14B4,0x3F6C29,0x29A47D,0x576B6F,0x238CCF,0x2CA83F,0x5C7],[0x7FAA9F,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01],[0x7FAA63,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01],[0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x7FE38F,0x7FFFFF,0x2A4D53,0x2E3555,0x15554E,0x418147,0x69E414,0x8231A,0x63FCD,0x2DF7AE,0x309F0F,0x1F223E,0x7E76BC,0x432126,0x755337,0x2FC5E,0x8AB],[0x2A97BE,0x555555,0x7188E2,0x1ECE38,0x638E34,0x2BAB84,0x7142B8,0x5AC211,0x42A88,0x73FA74,0x4B14B4,0x3F6C29,0x29A47D,0x576B6F,0x238CCF,0x2CA83F,0x5C7],[0x46D706,0xE38E3,0x204B3F,0x46497B,0x425EBF,0x201F91,0x1F49F9,0x221CEC,0x649BF5,0x2940FE,0x3DF697,0x688C98,0x18B076,0x6B3498,0x2D044E,0x23BE3D,0x1530],[0x7FAA99,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01],[0x7FA9D3,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01],[0x7FA8FB,0x7FFFFF,0x7EE7FB,0xA9FFF,0x3FFFEB,0x4483D5,0x3DAC3D,0x186950,0x12BF67,0x9E70A,0x11DD2E,0x5D66BB,0x7B6434,0x496374,0x5FF9A6,0x8F51C,0x1A01]],


        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,

    };

    return ROM_CURVE_BLS12381;
};


ROM_CURVE_BLS12461 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BLS12461 = {

        // BLS12461 Curve
        // Base Bits= 23

        CURVE_Cof_I : 0,
        CURVE_B_I: 9,
        CURVE_B: [0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1, 0x0, 0x700000, 0x7F7FFF, 0x7FEFF, 0x22000, 0x7F2000, 0x7E00BF, 0xE801, 0x40BFA0, 0x5FF, 0x7FE00C, 0x7FFF7F, 0x1FF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gx: [0x5EE93D, 0x4D515, 0x504534, 0x773A5B, 0x2D9C00, 0x6358FE, 0x6606D4, 0x4114E1, 0x4DC921, 0x21A6AC, 0x282599, 0x7BE149, 0x436166, 0x45632E, 0x1A2FA4, 0x38967B, 0xC8132, 0x476E74, 0x3A66D1, 0x56873A, 0x0],
        CURVE_Gy: [0x51D465, 0x462AF5, 0x51C3DD, 0x64627F, 0x517884, 0x71A42B, 0x6799A, 0x2CE854, 0x245F49, 0x15CB86, 0x2E1244, 0x45FD20, 0x16EECB, 0x3F197D, 0x3322FE, 0x1793BD, 0x5F1C3F, 0x3ED192, 0x452CC1, 0x3BDE6D, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x0, 0x7FFC00, 0x7FFFEF, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
		CURVE_Cof: [0x1, 0x7FFC00, 0x7FFFEF, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        //CURVE_Cof: [0x2AAAAB, 0x7FFD55, 0x5AAA9F, 0x5580AA, 0x7D55AA, 0x2A9FFF, 0x5555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Pxa: [0x50A37C, 0x20630D, 0x31196D, 0x173AEE, 0x1C2E49, 0x2D0F15, 0x7E467, 0x7AB270, 0x74FF92, 0x610DB6, 0x19A00F, 0x36AC0D, 0x6D78D4, 0x78520F, 0x224BE5, 0x1E1386, 0x767945, 0x4A1535, 0x4E281A, 0x662A0, 0x1],
        CURVE_Pxb: [0x41C0AD, 0x395185, 0x37A7E1, 0x6212E5, 0x16CD66, 0x4512C1, 0x4A546, 0x200D63, 0x3EBEE2, 0x7AA535, 0x7D96C5, 0x504E99, 0x45AF5B, 0x6E3DA9, 0x4B9350, 0x123533, 0x2279D2, 0x1D46F9, 0x53F96B, 0x4AE0FD, 0x0],
        CURVE_Pya: [0x2FB006, 0x218360, 0xCDF33, 0x525095, 0x53D194, 0x125912, 0x5833F3, 0x6345A4, 0xF39F, 0x1E7536, 0x7B46E8, 0x3EDDE2, 0x4DFD8A, 0x5EF53, 0x3489F3, 0x7A739F, 0x6070F4, 0x74FCCE, 0x1239FA, 0x113564, 0x0],
        CURVE_Pyb: [0x71457C, 0xD5BFB, 0x2A294, 0x6E0261, 0x4D6A31, 0x6DC7F6, 0x26A3C4, 0x2B3475, 0x64492F, 0x2E7877, 0x19E84A, 0x25F55D, 0x220BE7, 0x5C70AD, 0x7C1310, 0x228AB, 0x2AB1D0, 0x6805D4, 0x6D3EAE, 0x71C080, 0x0],
 
        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,

    };

    return ROM_CURVE_BLS12461;
};

ROM_CURVE_FP256BN = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_FP256BN = {

        // FP256BN Curve
        // Base Bits= 24

        CURVE_Cof_I : 1,
        CURVE_B_I: 3,
        CURVE_B: [0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0xB500D, 0x536CD1, 0x1AF62D, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
        CURVE_Gx: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0xB0A801, 0xF5C030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Pxa: [0xC09EFB, 0x16B689, 0x3CD226, 0x12BF84, 0x1C539A, 0x913ACE, 0x577C28, 0x28560F, 0xC96C20, 0x3350B4, 0xFE0C],
        CURVE_Pxb: [0x7E6A2B, 0xED34A3, 0x89D269, 0x87D035, 0xDD78E2, 0x13B924, 0xC637D8, 0xDB5AE1, 0x8AC054, 0x605773, 0x4EA6],
        CURVE_Pya: [0xDC27FF, 0xB481BE, 0x48E909, 0x8D6158, 0xCB2475, 0x3E51EF, 0x75124E, 0x76770D, 0x42A3B3, 0x46E7C5, 0x7020],
        CURVE_Pyb: [0xAD049B, 0x81114A, 0xB3E012, 0x821A98, 0x4CBE80, 0xB29F8B, 0x49297E, 0x42EEA6, 0x88C290, 0xE3BCD3, 0x554],

        CURVE_W: [
            [0x54003, 0x36E1B, 0x663AF0, 0xFFFE78, 0xFFFFFF, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_SB: [
            [
                [0x669004, 0xEEEE7C, 0x670BF5, 0xFFFE78, 0xFFFFFF, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x6100A, 0x4FFEB6, 0xB4BB3D, 0x129B19, 0xDC65FB, 0xA49D0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF]
            ]
        ],
        CURVE_WB: [
            [0x30A800, 0x678F0D, 0xCC1020, 0x5554D2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x7DC805, 0x764C0D, 0xAD1AD6, 0xA10BC3, 0xDE8FBE, 0x104467, 0x806160, 0xD105EB, 0x0, 0x0, 0x0],
            [0x173803, 0xB6061F, 0xD6C1AC, 0x5085E1, 0xEF47DF, 0x82233, 0xC030B0, 0x6882F5, 0x0, 0x0, 0x0],
            [0x91F801, 0x530F6E, 0xCCE126, 0x5554D2, 0x555555, 0x55, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_BB: [
            [
                [0x5AA80D, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0x5AA80C, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0x5AA80C, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0x615002, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x5AA80C, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0x5AA80D, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0x5AA80C, 0x5DACA0, 0x1A8DAA, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF]
            ],
            [
                [0x615002, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x615001, 0xEB8061, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0xB0A802, 0xF5C030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xC2A002, 0xD700C2, 0x1A20B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xAA000A, 0x67EC6F, 0x1A2527, 0x129992, 0xDC65FB, 0xA49E0C, 0x5EEE71, 0x46E5F2, 0xFCF0CD, 0xFFFFFF, 0xFFFF],
                [0xB0A802, 0xF5C030, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ]
        ],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,

    };

    return ROM_CURVE_FP256BN;
};

ROM_CURVE_FP512BN = function() {

    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_FP512BN = {

        // FP512BN Curve

        // Base Bits= 23


        CURVE_Cof_I : 1,
        CURVE_B_I: 3,
        CURVE_B: [0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1A09ED, 0x14BEA3, 0x501A99, 0x27CD15, 0x313E0, 0x346942, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
        CURVE_Gx: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gy: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x1BD80F, 0xD76BC, 0x4042CC, 0x587BF, 0x2F5C03, 0xD10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxa: [0x3646B5, 0x52DC1B, 0x7A3C1E, 0x48397F, 0xF8731, 0x71E443, 0x6F2EF1, 0x2BDF10, 0x4DC6DC, 0x70C6A2, 0x40914D, 0x3C6685, 0x5A57CC, 0x3736AF, 0x4D63C3, 0x5DE94D, 0x6A1E4B, 0x25E79, 0x6E9D, 0x244AC4, 0x1E1386, 0x62CA67, 0xE],
        CURVE_Pxb: [0xAE0E9, 0x17DFB5, 0x6CF6D7, 0x6C4488, 0x4A411C, 0x5B9C81, 0x4E0F56, 0x286B70, 0x6E0D5E, 0x650AA4, 0x607889, 0x5CA6CB, 0x302566, 0x48ED51, 0x1B1BBC, 0x532B6E, 0x34825E, 0x157D1, 0x6D311A, 0x3F3644, 0x3F8506, 0x38279, 0x12],
        CURVE_Pya: [0x5E67A1, 0x6255B, 0x178920, 0xAF7DC, 0x217AD6, 0x778B9B, 0xA022D, 0x11892A, 0x3E8EDD, 0x7BD82A, 0x5B3462, 0x34CEA5, 0x65C158, 0x1BA07D, 0x5982BF, 0x42D8EF, 0x4F2770, 0x19746E, 0x3BD6AC, 0x3DC149, 0x4C827C, 0x603D90, 0x1B],
        CURVE_Pyb: [0x4F8E8B, 0x630D90, 0x5A162D, 0x25FBB0, 0x5C222, 0x11BFE, 0x7B89E7, 0x18856B, 0x714A4, 0x7C5CA, 0xA25FF, 0xCA0ED, 0x3D0496, 0x61936C, 0x46219E, 0xA1C60, 0x591F02, 0x62BEEB, 0xD9030, 0x3C18D6, 0x48B04E, 0x34779D, 0x14],
        CURVE_W: [
            [0x34583, 0x712E93, 0x4FC443, 0x68B50B, 0x5FB911, 0x47FD2C, 0x7FFF3D, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_SB: [
            [
                [0x4B9564, 0x56411A, 0x4F3EAB, 0x5DA58C, 0x1010B, 0x47E30C, 0x7FFF3D, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x6259CE, 0x79D12A, 0x4F9500, 0x1CBD96, 0x245BDA, 0x344F21, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F]
            ],
            [
                [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x34583, 0x712E93, 0x4FC443, 0x68B50B, 0x5FB911, 0x47FD2C, 0x7FFF3D, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ]
        ],
        CURVE_WB: [
            [0x5A29F0, 0x66D56A, 0x305B6A, 0x2C1E98, 0x442C60, 0x42BF7F, 0x555514, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x355D4B, 0x25744, 0x45FBAC, 0x6BFC27, 0x20FC1F, 0x6BCB9E, 0x2778AE, 0x2C497D, 0x5AD40F, 0x72C0C9, 0x4549D2, 0x29A8B1, 0x576BC3, 0x42CC1, 0x587BF8, 0x75C030, 0xD105, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x289AAD, 0x7E700, 0x431F3C, 0x38C1F3, 0x282C11, 0x35EC57, 0x53BC57, 0x5624BE, 0x6D6A07, 0x396064, 0x62A4E9, 0x54D458, 0x6BB5E1, 0x21660, 0x2C3DFC, 0x7AE018, 0x6882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x2279D1, 0x4BE7F2, 0x2FD5D2, 0x210F19, 0x65745A, 0x42A55E, 0x555514, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_BB: [
            [
                [0x1BD810, 0xD76BC, 0x4042CC, 0x587BF, 0x2F5C03, 0xD10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1BD80F, 0xD76BC, 0x4042CC, 0x587BF, 0x2F5C03, 0xD10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1BD80F, 0xD76BC, 0x4042CC, 0x587BF, 0x2F5C03, 0xD10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x6259CF, 0x79D12A, 0x4F9500, 0x1CBD96, 0x245BDA, 0x344F21, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F]
            ],
            [
                [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x7E31DE, 0x747E6, 0xFD7CD, 0x224556, 0x53B7DD, 0x345C31, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
                [0x7E31DD, 0x747E6, 0xFD7CD, 0x224556, 0x53B7DD, 0x345C31, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
                [0x7E31DE, 0x747E6, 0xFD7CD, 0x224556, 0x53B7DD, 0x345C31, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F]
            ],
            [
                [0x37B01E, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x37B01F, 0x1AED78, 0x8598, 0xB0F7F, 0x5EB806, 0x1A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x7E31DF, 0x0747E6, 0x0FD7CD, 0x224556, 0x53B7DD, 0x345C31, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
                [0x2AA9AF, 0x5EE3B2, 0x4F0F68, 0x11AE17, 0x45A3D4, 0x343500, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
                [0x37B01D, 0x1AED78, 0x008598, 0x0B0F7F, 0x5EB806, 0x001A20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x7E31DF, 0x0747E6, 0x0FD7CD, 0x224556, 0x53B7DD, 0x345C31, 0x2AC99E, 0x4632EF, 0x18B8E4, 0x3D597D, 0x451B3C, 0x77A22, 0x3C111B, 0x78177C, 0x32D4C1, 0x5D0EC, 0x7F01C6, 0x7FF3D8, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F]
            ]
        ],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,

    };

    return ROM_CURVE_FP512BN;
};

ROM_CURVE_BN254 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BN254 = {

        // BN254 Curve

        // Base Bits= 24

        CURVE_Cof_I : 1,
        CURVE_B_I: 2,
        CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0xD, 0x0, 0x10A100, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
        CURVE_Gx: [0x12, 0x0, 0x13A700, 0x0, 0x210000, 0x861, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
        CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0x1, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxa: [0x3FB2B, 0x4224C8, 0xD91EE, 0x4898BF, 0x648BBB, 0xEDB6A4, 0x7E8C61, 0xEB8D8C, 0x9EB62F, 0x10BB51, 0x61A],
        CURVE_Pxb: [0xD54CF3, 0x34C1E7, 0xB70D8C, 0xAE3784, 0x4D746B, 0xAA5B1F, 0x8C5982, 0x310AA7, 0x737833, 0xAAF9BA, 0x516],
        CURVE_Pya: [0xCD2B9A, 0xE07891, 0xBD19F0, 0xBDBE09, 0xBD0AE6, 0x822329, 0x96698C, 0x9A90E0, 0xAF9343, 0x97A06B, 0x218],
        CURVE_Pyb: [0x3ACE9B, 0x1AEC6B, 0x578A2D, 0xD739C9, 0x9006FF, 0x8D37B0, 0x56F5F3, 0x8F6D44, 0x8B1526, 0x2B0E7C, 0xEBB],
        CURVE_W: [
            [0x3, 0x0, 0x20400, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_SB: [
            [
                [0x4, 0x0, 0x28500, 0x0, 0x818000, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xA, 0x0, 0xE9D00, 0x0, 0x1E0000, 0x79E, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523]
            ]
        ],
        CURVE_WB: [
            [0x0, 0x0, 0x4080, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x5, 0x0, 0x54A80, 0x0, 0x70000, 0x1C7, 0x800000, 0x312241, 0x0, 0x0, 0x0],
            [0x3, 0x0, 0x2C580, 0x0, 0x838000, 0xE3, 0xC00000, 0x189120, 0x0, 0x0, 0x0],
            [0x1, 0x0, 0xC180, 0x0, 0x808000, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_BB: [
            [
                [0xD, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0xC, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0xC, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xC, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0xD, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0xC, 0x0, 0x106080, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523]
            ],
            [
                [0x2, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x1, 0x0, 0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x2, 0x0, 0x10200, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xA, 0x0, 0x102000, 0x0, 0x9F8000, 0x7FF, 0x800000, 0xBA344D, 0x1, 0x648240, 0x2523],
                [0x2, 0x0, 0x4080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ]
        ],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,
    };

    return ROM_CURVE_BN254;
};

ROM_CURVE_BN254CX = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_BN254CX = {

        // BN254CX Curve
        // Base Bits= 24

        CURVE_Cof_I : 1,
        CURVE_B_I: 2,
        CURVE_B: [0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0xEB1F6D, 0xC0A636, 0xCEBE11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
        CURVE_Gx: [0x1B55B2, 0x23EF5C, 0xE1BE66, 0x18093E, 0x3FD6EE, 0x66D324, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
        CURVE_Gy: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

        CURVE_Bnx: [0xC012B1, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Cof: [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],

        CURVE_Pxa: [0xD2EC74,0x1CEEE4,0x26C085,0xA03E27,0x7C85BF,0x4BBB90,0xF5C3,0x358B25,0x53B256,0x2D2C70,0x1968],
        CURVE_Pxb: [0x29CFE1,0x8E8B2E,0xF47A5,0xC209C3,0x1B97B0,0x9743F8,0x37A8E9,0xA011C9,0x19F64A,0xB9EC3E,0x1466],
        CURVE_Pya: [0xBE09F,0xFCEBCF,0xB30CFB,0x847EC1,0x61B33D,0xE20963,0x157DAE,0xD81E22,0x332B8D,0xEDD972,0xA79],
        CURVE_Pyb: [0x98EE9D,0x4B2288,0xEBED90,0x69D2ED,0x864EA5,0x3461C2,0x512D8D,0x35C6E4,0xC4C090,0xC39EC,0x616],


        CURVE_W: [
            [0x2FEB83, 0x634916, 0x120054, 0xB4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_SB: [
            [
                [0xB010E4, 0x63491D, 0x128054, 0xB4038, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0xBB33EA, 0x5D5D20, 0xBCBDBD, 0x188CE, 0x3FD6EE, 0x66D264, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400]
            ]
        ],
        CURVE_WB: [
            [0x7A84B0, 0x211856, 0xB0401C, 0x3C012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0],
            [0x220475, 0xF995BE, 0x9A36CD, 0xA8CA7F, 0x7E94ED, 0x2A0DC0, 0x870, 0x300000, 0x0, 0x0, 0x0],
            [0xF10B93, 0xFCCAE0, 0xCD3B66, 0xD4653F, 0x3F4A76, 0x1506E0, 0x438, 0x180000, 0x0, 0x0, 0x0],
            [0xFAAA11, 0x21185D, 0xB0C01C, 0x3C012, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0]
        ],
        CURVE_BB: [
            [
                [0x2B0CBD, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0x2B0CBC, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0x2B0CBC, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x2B0CBC, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0x2B0CBD, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0x2B0CBC, 0xC0A633, 0xCE7E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400]
            ],
            [
                [0x802562, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x802561, 0x7, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ],
            [
                [0xC012B2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x4AC2, 0xF, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
                [0x6AFA0A, 0xC0A62F, 0xCE3E11, 0xCC906, 0x3FD6EE, 0x66D2C4, 0x647A63, 0xB0BDDF, 0x702A0D, 0x8, 0x2400],
                [0xC012B2, 0x3, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
            ]
        ],

        USE_GLV: true,
        USE_GS_G2: true,
        USE_GS_GT: true,
        GT_STRONG: false,

        //debug: false,

    };

    return ROM_CURVE_BN254CX;
};

ROM_CURVE_BRAINPOOL = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    /* Note that the original curve has been transformed to an isomorphic curve with A=-3 */


    var ROM_CURVE_BRAINPOOL = {

        // Brainpool curve
        // Base Bits= 24

        CURVE_Cof_I : 1,
        CURVE_B_I: 0,
        CURVE_B: [0xE92B04, 0x8101FE, 0x256AE5, 0xAF2F49, 0x93EBC4, 0x76B7BF, 0x733D0B, 0xFE66A7, 0xD84EA4, 0x61C430, 0x662C],
        CURVE_Order: [0x4856A7, 0xE8297, 0xF7901E, 0xB561A6, 0x397AA3, 0x8D718C, 0x909D83, 0x3E660A, 0xEEA9BC, 0x57DBA1, 0xA9FB],
        CURVE_Gx: [0x1305F4, 0x91562E, 0x2B79A1, 0x7AAFBC, 0xA142C4, 0x6149AF, 0xB23A65, 0x732213, 0xCFE7B7, 0xEB3CC1, 0xA3E8],
        CURVE_Gy: [0x25C9BE, 0xE8F35B, 0x1DAB, 0x39D027, 0xBCB6DE, 0x417E69, 0xE14644, 0x7F7B22, 0x39C56D, 0x6C8234, 0x2D99],
        CURVE_HTPC: [0xBC7B16,0x14BB03,0x88EBBC,0x2DEAE8,0x4730D2,0xFD9592,0xDF0183,0x737593,0xC052E1,0xC79CF0,0x6665],
        };
    return ROM_CURVE_BRAINPOOL;
};

ROM_CURVE_C25519 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_C25519 = {

        // C25519 Curve

        CURVE_Cof_I : 8,
        CURVE_B_I: 0,
        CURVE_B: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0xF5D3ED, 0x631A5C, 0xD65812, 0xA2F79C, 0xDEF9DE, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000],
        CURVE_Gx: [0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gy: [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x7504F,0xD93A5,0x3C6277,0x5697F2,0xA18C03,0xEBD397,0x4C9EFD,0x95A680,0xE0EF85,0x924027,0x55C1],
    };
    return ROM_CURVE_C25519;
};

ROM_CURVE_C41417 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_C41417 = {

        // C41417 curve
        CURVE_Cof_I : 8,
        CURVE_B_I: 3617,
        CURVE_B: [0xE21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x6AF79, 0x69784, 0x1B0E7, 0x18F3C6, 0x338AD, 0xDBC70, 0x6022B, 0x533DC, 0x3CC924, 0x3FFFAC, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x3FFFFF, 0x7FFF],
        CURVE_Gx: [0xBC595, 0x204BCF, 0xC4FD3, 0x14DF19, 0x33FAA8, 0x4C069, 0x16BA11, 0x2AD35B, 0x1498A4, 0x15FFCD, 0x3EC7F, 0x27D130, 0xD4636, 0x9B97F, 0x631C3, 0x8630, 0x144330, 0x241450, 0x1A334],
        CURVE_Gy: [0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_HTPC: [0x3FFFEE,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFFF,0x3FFFF],
    };

    return ROM_CURVE_C41417;
};

ROM_CURVE_C1174 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_C1174 = {

        // C1174 curve
        CURVE_Cof_I: 4,
        CURVE_Cof: [0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: -1174,
        CURVE_B: [0xFFFB61,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0x7FF],
        CURVE_Order: [0x66C971,0xD45FD1,0x348944,0xDFD307,0x7965C4,0xFFFFF7,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0x1FF],
        CURVE_Gx: [0xE29EDA,0x3F27BC,0x651612,0x492ECD,0x21D96A,0xA190C0,0xE7C029,0x9343AE,0x308C47,0xBB0CEA,0x37F],
        CURVE_Gy: [0x46360E,0xB1BF9B,0x6BA4CC,0xAF3F97,0xE2DEE2,0xE0C4F,0x116984,0x665684,0x7FB7CC,0x2F82D4,0x6B7],
        CURVE_HTPC: [0xFFFFF6,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0x7FF],
    };

    return ROM_CURVE_C1174;
};


ROM_CURVE_C1665 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_C1665 = {

        // C1665 curve
        CURVE_Cof_I: 4,
        CURVE_Cof: [0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 5766,
        CURVE_B: [0x1686,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0x3A8B27,0x61533B,0x40603F,0x7FEAF7,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7],
        CURVE_Gx: [0x552398,0x73B7F3,0x1B19C6,0x7707B3,0x1A0618,0x20B701,0x325369,0xA],
        CURVE_Gy: [0x120345,0xF6489,0x70B1C2,0x1CEB16,0x3BFC77,0x378142,0x505152,0x14],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
    };

    return ROM_CURVE_C1665;
};


ROM_CURVE_MDC = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_MDC = {

        // Million Dollar curve
        CURVE_Cof_I: 4,
        CURVE_Cof: [0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 0,
        CURVE_B: [0xCF89,0x92503,0x41EE93,0x3F21F0,0x1270F6,0xB9625F,0xCCFB0C,0x7CDFBF,0x65B68A,0x45219,0x5713],
        CURVE_Order: [0xB0F7FB,0x52F421,0xBB5885,0xFAF974,0xB38975,0x7F534F,0xBF75E9,0x14CBE4,0x15ABED,0xDA2E75,0x3C4E],
        CURVE_Gx: [0x68363B,0x25BFEE,0xE2232C,0x8D2713,0xD72ABB,0xCF6350,0x1E03CB,0xD85B42,0x903B83,0x886A7F,0xB681],
        CURVE_Gy: [0x2864B5,0xC355BD,0x3A7E73,0x81A93A,0xA8BC3D,0xDA421D,0xCF6563,0x59814D,0x9C0B03,0x34E1B5,0xCA67],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        };

    return ROM_CURVE_MDC;
};


ROM_CURVE_ED25519 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_ED25519 = {

        // ED25519 Curve

        CURVE_Cof_I : 8,
        CURVE_B_I: 0,
        CURVE_B: [0x5978A3, 0x4DCA13, 0xAB75EB, 0x4141D8, 0x700A4D, 0xE89800, 0x797779, 0x8CC740, 0x6FFE73, 0x6CEE2B, 0x5203],
        CURVE_Order: [0xF5D3ED, 0x631A5C, 0xD65812, 0xA2F79C, 0xDEF9DE, 0x14, 0x0, 0x0, 0x0, 0x0, 0x1000],
        CURVE_Gx: [0x25D51A, 0x2D608F, 0xB2C956, 0x9525A7, 0x2CC760, 0xDC5C69, 0x31FDD6, 0xC0A4E2, 0x6E53FE, 0x36D3CD, 0x2169],
        CURVE_Gy: [0x666658, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x666666, 0x6666],
        CURVE_HTPC: [0x7504F,0xD93A5,0x3C6277,0x5697F2,0xA18C03,0xEBD397,0x4C9EFD,0x95A680,0xE0EF85,0x924027,0x55C1],

    };
    return ROM_CURVE_ED25519;
};

ROM_CURVE_GOLDILOCKS = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_GOLDILOCKS = {

        // GOLDILOCKS curve
        CURVE_Cof_I : 4,
        CURVE_B_I: -39081,
        CURVE_B: [0x7F6756, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7DFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FF],
        CURVE_Order: [0x5844F3, 0x52556, 0x548DE3, 0x6E2C7A, 0x4C2728, 0x52042D, 0x6BB58D, 0x276DA4, 0x23E9C4, 0x7EF994, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x1FF],
        CURVE_Gx: [0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x52AAAA, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555555, 0x2AAAAA, 0x555],
        CURVE_Gy: [0x1386ED, 0x779BD5, 0x2F6BAB, 0xE6D03, 0x4B2BED, 0x131777, 0x4E8A8C, 0x32B2C1, 0x44B80D, 0x6515B1, 0x5F8DB5, 0x426EBD, 0x7A0358, 0x6DDA, 0x21B0AC, 0x6B1028, 0xDB359, 0x15AE09, 0x17A58D, 0x570],
        CURVE_HTPC: [0x7FFFFE,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7DFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FF],

        };
    return ROM_CURVE_GOLDILOCKS;
};

ROM_CURVE_X448 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_X448 = {

        // X448 curve
        CURVE_Cof_I: 4,
        CURVE_Cof: [0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 0,
        CURVE_B: [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0x5844F3,0x52556,0x548DE3,0x6E2C7A,0x4C2728,0x52042D,0x6BB58D,0x276DA4,0x23E9C4,0x7EF994,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x1FF],
        CURVE_Gx: [0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Gy: [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_HTPC: [0x7FFFFE,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7DFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FF],
    };
    return ROM_CURVE_X448;
};

ROM_CURVE_HIFIVE = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_HIFIVE = {

        // HIFIVE curve

        CURVE_Cof_I : 8,
        CURVE_B_I: 11111,
        CURVE_B: [0x2B67, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x1FA805, 0x2B2E7D, 0x29ECBE, 0x3FC9DD, 0xBD6B8, 0x530A18, 0x45057E, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x800],
        CURVE_Gx: [0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Gy: [0x7E8632, 0xD0A0B, 0x6C4AFB, 0x501B2E, 0x55650C, 0x36DB6B, 0x1FBD0D, 0x61C08E, 0x314B46, 0x70A7A3, 0x587401, 0xC70E0, 0x56502E, 0x38C2D6, 0x303],
        CURVE_HTPC: [0x531622,0x37D80A,0x3928FF,0x1B054E,0x35D63A,0x6A25B3,0x406AE8,0x278495,0x339DF0,0x2AC208,0xE9A97,0x1FB80F,0x70856C,0x3C1FC,0xD8],
    };
    return ROM_CURVE_HIFIVE;
};

ROM_CURVE_NIST256 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NIST256 = {

        // NIST256 Curve
        CURVE_Cof_I : 1,
        CURVE_B_I: 0,
        CURVE_B: [0xD2604B, 0x3C3E27, 0xF63BCE, 0xCC53B0, 0x1D06B0, 0x86BC65, 0x557698, 0xB3EBBD, 0x3A93E7, 0x35D8AA, 0x5AC6],
        CURVE_Order: [0x632551, 0xCAC2FC, 0x84F3B9, 0xA7179E, 0xE6FAAD, 0xFFFFBC, 0xFFFFFF, 0xFFFFFF, 0x0, 0xFFFF00, 0xFFFF],
        CURVE_Gx: [0x98C296, 0x3945D8, 0xA0F4A1, 0x2DEB33, 0x37D81, 0x40F277, 0xE563A4, 0xF8BCE6, 0x2C4247, 0xD1F2E1, 0x6B17],
        CURVE_Gy: [0xBF51F5, 0x406837, 0xCECBB6, 0x6B315E, 0xCE3357, 0x9E162B, 0x4A7C0F, 0x8EE7EB, 0x1A7F9B, 0x42E2FE, 0x4FE3],
        CURVE_HTPC: [0x613926,0x47959C,0xD42EB8,0x452A9D,0x3EB001,0x55548D,0x8F44A6,0x5240B3,0x3723A4,0xD82CB6,0x6A2A],
    };
    return ROM_CURVE_NIST256;
};

ROM_CURVE_SM2 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_SM2 = {

        // SM2 Curve

		CURVE_Cof_I: 1,
		CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
		CURVE_B_I: 0,
		CURVE_B: [0x940E93,0xBD414D,0x92DDBC,0x15AB8F,0x9789F5,0x9A7F3,0x4BCF65,0x4D5A9E,0x9F5E34,0xFA9E9D,0x28E9],
		CURVE_Order: [0xD54123,0xF40939,0x2B53BB,0x21C605,0x3DF6B,0xFFFF72,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFEFF,0xFFFF],
		CURVE_Gx: [0x4C74C7,0x458933,0xE1715A,0xF2660B,0xE30BBF,0xC9948F,0x466A39,0x5F9904,0x198119,0xAE2C1F,0x32C4],
		CURVE_Gy: [0x39F0A0,0x32E521,0x4002DF,0xC62A47,0xA9877C,0x2153D0,0xE36B69,0x59BDCE,0xF6779C,0x36A2F4,0xBC37],
        CURVE_HTPC: [0xFFFFFF,0xFFFFFF,0x55FFFF,0x555555,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xAAA9FF,0xAAAA],
    };
    return ROM_CURVE_SM2;
};

ROM_CURVE_NIST384 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NIST384 = {

        // NIST384 curve
        CURVE_Cof_I : 1,
        CURVE_B_I: 0,
        CURVE_B: [0x6C2AEF, 0x11DBA7, 0x74AA17, 0x51768C, 0x6398D8, 0x6B58CA, 0x5404E1, 0xA0447, 0x411203, 0x5DFD02, 0x607671, 0x4168C8, 0x56BE3F, 0x1311C0, 0xFB9F9, 0x17D3F1, 0xB331],
        CURVE_Order: [0x452973, 0x32D599, 0x6BB3B0, 0x45853B, 0x20DB24, 0x3BEB03, 0x7D0DCB, 0x31A6C0, 0x7FFFC7, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0xFFFF],
        CURVE_Gx: [0x760AB7, 0x3C70E4, 0x30E951, 0x7AA94B, 0x2F25DB, 0x470AA0, 0x20950A, 0x7BA0F0, 0x1B9859, 0x45174F, 0x3874ED, 0x56BA3, 0x71EF32, 0x71D638, 0x22C14D, 0x65115F, 0xAA87],
        CURVE_Gy: [0x6A0E5F, 0x3AF921, 0x75E90C, 0x6BF40C, 0xB1CE1, 0x18014C, 0x6D7C2E, 0x6D1889, 0x147CE9, 0x7A5134, 0x63D076, 0x16E14F, 0xBF929, 0x6BB3D3, 0x98B1B, 0x6F254B, 0x3617],
        CURVE_HTPC: [0x5CD21B,0x589A81,0x4CF909,0x3AA056,0x42D2A8,0x7DDA0A,0x421117,0x2FB357,0x63B4BD,0x6A06E8,0x225E,0x43E017,0x3FECA5,0x97AD4,0x5C5492,0x787911,0xBC6E],
        };
    return ROM_CURVE_NIST384;
};

ROM_CURVE_NIST521 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NIST521 = {

        // NIST521 curve

        CURVE_Cof_I : 1,
        CURVE_B_I: 0,
        CURVE_B: [0x503F00, 0x3FA8D6, 0x47BD14, 0x6961A7, 0x3DF883, 0x60E6AE, 0x4EEC6F, 0x29605E, 0x137B16, 0x23D8FD, 0x5864E5, 0x84F0A, 0x1918EF, 0x771691, 0x6CC57C, 0x392DCC, 0x6EA2DA, 0x6D0A81, 0x688682, 0x50FC94, 0x18E1C9, 0x27D72C, 0x1465],
        CURVE_Order: [0x386409, 0x6E3D22, 0x3AEDBE, 0x4CE23D, 0x5C9B88, 0x3A0776, 0x3DC269, 0x6600A4, 0x166B7F, 0x77E5F, 0x461A1E, 0x7FFFD2, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFF],
        CURVE_Gx: [0x65BD66, 0x7C6385, 0x6FE5F9, 0x2B5214, 0xB3C18, 0x1BC669, 0x68BFEA, 0xEE093, 0x5928FE, 0x6FDFCE, 0x52D79, 0x69EDD5, 0x7606B4, 0x3F0515, 0x4FED48, 0x409C82, 0x429C64, 0x472B68, 0x7B2D98, 0x4E6CF1, 0x70404E, 0x31C0D6, 0x31A1],
        CURVE_Gy: [0x516650, 0x28ED3F, 0x222FA, 0x139612, 0x47086A, 0x6C26A7, 0x4FEB41, 0x285C80, 0x2640C5, 0x32BDE8, 0x5FB9CA, 0x733164, 0x517273, 0x2F5F7, 0x66D11A, 0x2224AB, 0x5998F5, 0x58FA37, 0x297ED0, 0x22E4, 0x9A3BC, 0x252D4F, 0x460E],
        CURVE_HTPC: [0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3FFF],
        };
    return ROM_CURVE_NIST521;
};

ROM_CURVE_NUMS256E = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS256E = {

        // NUMS256E Curve
        CURVE_Cof_I : 4,
        CURVE_B_I: -15342,
        CURVE_B: [0xFFC355, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFF],
        CURVE_Order: [0xDD4AF5, 0xB190EE, 0x9B1A47, 0x2F5943, 0x955AA5, 0x41, 0x0, 0x0, 0x0, 0x0, 0x4000],
        CURVE_Gx: [0xED13DA, 0xC0902E, 0x86A0DE, 0xE30835, 0x398A0E, 0x9BD60C, 0x5F6920, 0xCD1E3D, 0xEA237D, 0x14FB6A, 0x8A75],
        CURVE_Gy: [0x8A89E6, 0x16E779, 0xD32FA6, 0x10856E, 0x5F61D8, 0x801071, 0xD9A64B, 0xCE9665, 0xD925C7, 0x3E9FD9, 0x44D5],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],

    };
    return ROM_CURVE_NUMS256E;
};

ROM_CURVE_NUMS256W = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS256W = {

        // NUMS256W Curve
        CURVE_Cof_I : 1,
        CURVE_B_I: 152961,
        CURVE_B: [0x25581, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x51A825, 0x202947, 0x6020AB, 0xEA265C, 0x3C8275, 0xFFFFE4, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFF],
        CURVE_Gx: [0x1AACB1, 0xEE1EB2, 0x3ABC52, 0x3D4C7, 0x579B09, 0xCB0983, 0xA04F42, 0x297A95, 0xAADB61, 0xD6B65A, 0xBC9E],
        CURVE_Gy: [0x84DE9F, 0xB9CB21, 0xBB80B5, 0x15310F, 0x55C3D1, 0xE035C9, 0xF77E04, 0x73448B, 0x99B6A6, 0xC0F133, 0xD08F],
        CURVE_HTPC: [0x2B84D6,0x6F7595,0x9E05FC,0x2040E8,0x4092C6,0xC6AE46,0x70CADD,0xB22ED0,0x11E3B5,0x44E454,0xCF7F],

    };
    return ROM_CURVE_NUMS256W;
};

ROM_CURVE_NUMS384E = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS384E = {

        // NUMS384E Curve
        CURVE_Cof_I : 4,
        CURVE_B_I: -11556,
        CURVE_B: [0x7FD19F, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0xFFFF],
        CURVE_Order: [0x23897D, 0x3989CD, 0x6482E7, 0x59AE43, 0x4555AA, 0x39EC3C, 0x2D1AF8, 0x238D0E, 0x7FFFE2, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3FFF],
        CURVE_Gx: [0x206BDE, 0x1C8D8, 0x4D4355, 0x2A2CA0, 0x292B16, 0x680DFE, 0x3CCC58, 0x31FFD4, 0x4C0057, 0xDCB7C, 0x4C2FD1, 0x2AEDAD, 0x2129AE, 0x1816D4, 0x6A499B, 0x8FDA2, 0x61B1],
        CURVE_Gy: [0x729392, 0x7C3E0, 0x727634, 0x376246, 0x2B0F94, 0x49600E, 0x7D9165, 0x7CC7B, 0x5F5683, 0x69E284, 0x5AB609, 0x86EB8, 0x1A423B, 0x10E716, 0x69BBAC, 0x1F33DC, 0x8298],
        CURVE_HTPC: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
    };
    return ROM_CURVE_NUMS384E;
};

ROM_CURVE_NUMS384W = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS384W = {

        // NUMS384W Curve
        CURVE_Cof_I : 1,
        CURVE_B_I: -34568,
        CURVE_B: [0x7F77BB, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0xFFFF],
        CURVE_Order: [0xE61B9, 0x3ECF6, 0x698136, 0x61BF13, 0x29D3D4, 0x1037DB, 0x3AD75A, 0xF578F, 0x7FFFD6, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0xFFFF],
        CURVE_Gx: [0x18152A, 0x740841, 0x6FAE72, 0x7B0E23, 0x6ED100, 0x684A45, 0x4A9B31, 0x5E948D, 0x79F4F3, 0x1BF703, 0x89707, 0x2F8D30, 0x222410, 0x91019, 0x5BC607, 0x2B7858, 0x7579],
        CURVE_Gy: [0x180716, 0x71D8CC, 0x1971D2, 0x7FA569, 0x6B4DBB, 0x6FD79A, 0x4486A0, 0x1041BE, 0x739CB9, 0x6FF0FE, 0x4011A5, 0x267BF5, 0x530058, 0x1AFC67, 0x66E38E, 0x71B470, 0xACDE],
        CURVE_HTPC: [0x7FFF61,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFF],

    };
    return ROM_CURVE_NUMS384W;
};

ROM_CURVE_NUMS512E = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS512E = {

        // NUMS512E Curve
        CURVE_Cof_I : 4,
        CURVE_B_I: -78296,
        CURVE_B: [0x7ECBEF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
        CURVE_Order: [0x6ED46D, 0x19EA37, 0x7D9D1A, 0x6F7F67, 0x605786, 0x5EA548, 0x5C2DA1, 0x1FEC64, 0x11BA9E, 0x5A5F9F, 0x53C18D, 0x7FFFFD, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0xF],
        CURVE_Gx: [0x6C57FE, 0x565333, 0x5716E6, 0x662780, 0x525427, 0x15A1FC, 0x15A241, 0x5EE4C9, 0x730F78, 0x1DDC8C, 0x188705, 0x5C0A3A, 0x6BE273, 0x44F42F, 0x7128E0, 0x73CFA6, 0x332FD1, 0x11A78A, 0x632DE2, 0x34E3D0, 0x5128DB, 0x71C62D, 0x37],
        CURVE_Gy: [0x62F5E1, 0x3D8183, 0x7CC9B7, 0x5F8E80, 0x6D38A9, 0x3FA04C, 0xABB30, 0xD0343, 0x356260, 0x65D32C, 0x3294F, 0x741A09, 0x395909, 0x55256D, 0x96748, 0x7B936C, 0x6EE476, 0x50544A, 0x43D5DE, 0x538CC5, 0x39D49C, 0x2137FE, 0x1B],
        CURVE_HTPC: [0x7FFDC6,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x3F],       
    };
    return ROM_CURVE_NUMS512E;
};

ROM_CURVE_NUMS512W = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_NUMS512W = {

        // NUMS512W Curve
        CURVE_Cof_I : 1,
        CURVE_B_I: 121243,
        CURVE_B: [0x1D99B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x33555D, 0x7E7208, 0xF3854, 0x3E692, 0x68B366, 0x38C76A, 0x65F42F, 0x612C76, 0x31B4F, 0x7729CF, 0x6CF293, 0x7FFFFA, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x7FFFFF, 0x3F],
        CURVE_Gx: [0x2BAE57, 0xF2B19, 0xB720A, 0x6B7AEF, 0x560137, 0x3063AB, 0x95585, 0x3CA143, 0x359E93, 0x220ED6, 0x408685, 0x36CFCA, 0xC2530, 0x28A0DC, 0x407DA1, 0x6C1DDA, 0x5298CA, 0x407A76, 0x2DC00A, 0x549ED1, 0x7141D0, 0x580688, 0xE],
        CURVE_Gy: [0x3527A6, 0xEC070, 0x248E82, 0x67E87F, 0x35C1E4, 0x4059E5, 0x2C9695, 0x10D420, 0x6DE9C1, 0x35161D, 0xA1057, 0xA78A5, 0x60C7BD, 0x11E964, 0x6F2EE3, 0x6DEF55, 0x4B97, 0x47D762, 0x3BBB71, 0x359E70, 0x229AD5, 0x74A99, 0x25],
        CURVE_HTPC: [0x7FFEE3,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x7FFFFF,0x1F],
    };
    return ROM_CURVE_NUMS512W;
};

ROM_CURVE_SECP256K1 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_SECP256K1 = {

        // SECP256K1 Curve
        // Base Bits= 24

        CURVE_Cof_I: 1,
        CURVE_B_I: 7,
        CURVE_B: [0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
        CURVE_Order: [0x364141, 0x5E8CD0, 0x3BBFD2, 0xAF48A0, 0xAEDCE6, 0xFFFEBA, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFF],
        CURVE_Gx: [0xF81798, 0x815B16, 0xD959F2, 0x2DCE28, 0x9BFCDB, 0xB0702, 0x95CE87, 0x55A062, 0xDCBBAC, 0x667EF9, 0x79BE],
        CURVE_Gy: [0x10D4B8, 0xD08FFB, 0x199C47, 0xA68554, 0x17B448, 0x8A8FD, 0xFC0E11, 0x5DA4FB, 0xA3C465, 0xDA7726, 0x483A],
        CURVE_HTPC: [0x8624AA,0x13789E,0x8ECDC8,0xC23F50,0xFDCA45,0xCD8BBB,0x640A39,0xF4D5B4,0x3FFE30,0xE9E881,0xCCE8],

        CURVE_Ad: [0x444533,0x47C01A,0x5D4054,0xCB6F0E,0x53D363,0xD272E9,0x58F0F5,0xA08A55,0x661ADC,0x31ABDD,0x3F87],
        CURVE_Bd: [0x6EB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        PC: [[0xAAA88C,0xE38DAA,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0x8E38],[0x9DD262,0xD0B53D,0x314ECB,0x37C40,0x506144,0xCAECE4,0xDECA25,0xE2A413,0xF234E6,0x328D23,0x534C],[0x7C6581,0x1044F1,0x92DFFF,0xBF63B,0x95D2FC,0x44C5D5,0xCEA7FD,0xB9F315,0xC321D5,0xD4C80B,0x7D3],[0xAAA8C7,0xE38DAA,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0xE38E38,0x8E38],[0x8C6D14,0x56612A,0xBBC52A,0x1F5E41,0xD36B64,0x225406,0xD51B54,0xF7C4B2,0x83DC1D,0xC6F643,0xEDAD],[0x1EB49B,0xB74578,0x7D9FE6,0x42F848,0xCD4095,0x40DD86,0xCBB7B6,0x9CA34C,0x94918A,0x71193D,0xD357],[0xE38D84,0xA12F38,0xF684BD,0x4BDA12,0xA12F68,0xF684BD,0x4BDA12,0xA12F68,0xF684BD,0x4BDA12,0x2F68],[0xCEE931,0xE85A9E,0x18A765,0x1BE20,0x2830A2,0xE57672,0xEF6512,0x715209,0xF91A73,0x194691,0x29A6],[0x1D71A3,0x90FC20,0x6FDFFC,0xD686DA,0x7AB046,0xA6D564,0x4B12A0,0xA9D0A5,0xCB7C0F,0xC32D5,0xC75E],[0x38E23C,0x684B8E,0xBDA12F,0x12F684,0x684BDA,0xBDA12F,0x12F684,0x684BDA,0xBDA12F,0x12F684,0x4BDA],[0xD2A76F,0x8192BF,0x99A7BF,0x2F0D62,0x3D2116,0x337E0A,0x3FA8FE,0xF3A70C,0x45CA2C,0xAA7165,0x6484],[0x5C2573,0x25D268,0x78DFB4,0xC8E8D9,0x67C1BF,0xC29894,0x632722,0xD5E9E6,0xBDB49F,0x534BB8,0x7A06],[0xFFF93B,0xFFFEFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFF]],


    };
    return ROM_CURVE_SECP256K1;
};

ROM_CURVE_SECP160R1 = function() {
    /* Fixed Data in ROM - Field and Curve parameters */

    var ROM_CURVE_SECP160R1 = {

        // SECP160R1 Curve
        // Base Bits= 24

        CURVE_Cof_I: 1,
        CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 0,
        CURVE_B: [0x65FA45,0xD4ADC5,0x9F81D4,0x65ACF8,0xBD7A8B,0xBEFC54,0x1C97],
        CURVE_Order: [0x752257,0xAED3CA,0xC8F927,0x1F4,0x0,0x0,0x10000],
        CURVE_Gx: [0xCBFC82,0x8BB913,0x8968C3,0x466469,0xF57328,0xB5688E,0x4A96],
        CURVE_Gy: [0xC5FB32,0x51377A,0x120423,0x59DCC9,0x68947D,0x285531,0x23A6],
        CURVE_HTPC: [0x5BC0DA,0xFAF3A2,0x7305DA,0xFACE6A,0x5A6106,0xBD02CD,0x1E50],
    };
    return ROM_CURVE_SECP160R1;
};

ROM_CURVE_JUBJUB = function() {
    // Fixed Data in ROM - Field and Curve parameters 

    var ROM_CURVE_JUBJUB = {

        // JUBJUB Curve
        // Base Bits= 24

        CURVE_Cof_I: 8,
        CURVE_Cof: [0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 0,
        CURVE_B: [0x343EB1,0x5FD6D6,0x260106,0x37579D,0x2D7F6D,0x7FD429,0x7E6BD,0xF5FD92,0xFA2B48,0x18E74B,0x2A93],
        CURVE_Order: [0xF72CB7,0xE5ED6,0x82D097,0xCCC810,0x682093,0x3B00A6,0x10134,0x6673B,0x33AFA9,0xB4EA65,0xE7D],
        CURVE_Gx: [0xF976C4,0xCF1A74,0xDE7F4E,0xF2F39E,0xC546B,0x488200,0xDF0038,0xA624B4,0xEFF38C,0x972AF8,0x5183],
        CURVE_Gy: [0x49702E,0xAD7093,0x3B146B,0xFFA683,0x6C8707,0xC30809,0x5ABD9D,0x9E8FCC,0xA2FC2C,0xF8472C,0x3B43],
        CURVE_HTPC: [0x7BBBB6,0xAEF9E4,0xA9907,0x517532,0x5DFF51,0xD546E2,0xCB473C,0x3E3EE,0x37B1D4,0x68B42B,0x62FD],        
    };
    return ROM_CURVE_JUBJUB;
};

ROM_CURVE_C13318 = function() {
    // Fixed Data in ROM - Field and Curve parameters 

    var ROM_CURVE_C13318 = {

        // C13318 Curve
        // Base Bits= 24

        CURVE_Cof_I: 1,
        CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 13318,
        CURVE_B: [0x3406,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0xC2CBE3,0x12DC4D,0x16EB7D,0x3DEB8D,0xF654F8,0xF4,0x0,0x0,0x0,0x0,0x8000],
        CURVE_Gx: [0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Gy: [0x6EAD0B,0xD3546B,0xB5B8C8,0xCF016D,0x4CCB04,0x66369D,0xE51669,0x381630,0xBCA6F1,0xAAD926,0x6675],
        CURVE_HTPC: [0x7504F,0xD93A5,0x3C6277,0x5697F2,0xA18C03,0xEBD397,0x4C9EFD,0x95A680,0xE0EF85,0x924027,0x55C1],
    };
    return ROM_CURVE_C13318;
};

ROM_CURVE_TWEEDLEDUM = function() {
    // Fixed Data in ROM - Field and Curve parameters 

    var ROM_CURVE_TWEEDLEDUM = {

    //*** rom curve parameters *****
        CURVE_Cof_I: 1,
        CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 5,
        CURVE_B: [0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0x1,0xAFD400,0xC9842C,0x696286,0x8AA127,0x3,0x0,0x0,0x0,0x0,0x4000],
        CURVE_Gx: [0x0,0x64E200,0xB9A140,0x6C3F59,0x8AA127,0x3,0x0,0x0,0x0,0x0,0x4000],
        CURVE_Gy: [0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_HTPC: [0x381795,0x755341,0xC366D6,0xD03CFB,0x10AEEB,0xBAA53E,0x8B6CAA,0xEF14D8,0x20BF4,0x6CF337,0x3AB4],
    };
    return ROM_CURVE_TWEEDLEDUM;
};

ROM_CURVE_TWEEDLEDEE = function() {
    // Fixed Data in ROM - Field and Curve parameters 

    var ROM_CURVE_TWEEDLEDEE = {

    //*** rom curve parameters *****
        CURVE_Cof_I: 1,
        CURVE_Cof: [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_B_I: 5,
        CURVE_B: [0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_Order: [0x1,0x64E200,0xB9A140,0x6C3F59,0x8AA127,0x3,0x0,0x0,0x0,0x0,0x4000],
        CURVE_Gx: [0x0,0xAFD400,0xC9842C,0x696286,0x8AA127,0x3,0x0,0x0,0x0,0x0,0x4000],
        CURVE_Gy: [0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0],
        CURVE_HTPC: [0x69C848,0x1CBDAD,0x873386,0x672EF6,0xAC0754,0xE9704,0xE5BC1A,0x82C6A2,0x649720,0x88DE2A,0x3AC1],
    };
    return ROM_CURVE_TWEEDLEDEE;
};

if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
    module.exports = {
        ROM_CURVE_ANSSI: ROM_CURVE_ANSSI,
        ROM_CURVE_BLS12383: ROM_CURVE_BLS12383,
        ROM_CURVE_BLS24479: ROM_CURVE_BLS24479,
        ROM_CURVE_BLS48556: ROM_CURVE_BLS48556,
        ROM_CURVE_BLS48286: ROM_CURVE_BLS48286,
        ROM_CURVE_BLS48581: ROM_CURVE_BLS48581,
        ROM_CURVE_BLS12381: ROM_CURVE_BLS12381,
        ROM_CURVE_BLS12461: ROM_CURVE_BLS12461,
        ROM_CURVE_BN462: ROM_CURVE_BN462,
        ROM_CURVE_FP256BN: ROM_CURVE_FP256BN,
        ROM_CURVE_FP512BN: ROM_CURVE_FP512BN,
        ROM_CURVE_BN254: ROM_CURVE_BN254,
        ROM_CURVE_BN254CX: ROM_CURVE_BN254CX,
        ROM_CURVE_BRAINPOOL: ROM_CURVE_BRAINPOOL,
        ROM_CURVE_C25519: ROM_CURVE_C25519,
        ROM_CURVE_C41417: ROM_CURVE_C41417,
        ROM_CURVE_C1174: ROM_CURVE_C1174,
        ROM_CURVE_C1665: ROM_CURVE_C1665,
        ROM_CURVE_MDC: ROM_CURVE_MDC,
        ROM_CURVE_ED25519: ROM_CURVE_ED25519,
        ROM_CURVE_GOLDILOCKS: ROM_CURVE_GOLDILOCKS,
        ROM_CURVE_X448: ROM_CURVE_X448,
        ROM_CURVE_HIFIVE: ROM_CURVE_HIFIVE,
        ROM_CURVE_NIST256: ROM_CURVE_NIST256,
        ROM_CURVE_NIST384: ROM_CURVE_NIST384,
        ROM_CURVE_NIST521: ROM_CURVE_NIST521,
        ROM_CURVE_NUMS256E: ROM_CURVE_NUMS256E,
        ROM_CURVE_NUMS256W: ROM_CURVE_NUMS256W,
        ROM_CURVE_NUMS384E: ROM_CURVE_NUMS384E,
        ROM_CURVE_NUMS384W: ROM_CURVE_NUMS384W,
        ROM_CURVE_NUMS512E: ROM_CURVE_NUMS512E,
        ROM_CURVE_NUMS512W: ROM_CURVE_NUMS512W,
        ROM_CURVE_SECP256K1: ROM_CURVE_SECP256K1,
        ROM_CURVE_SECP160R1: ROM_CURVE_SECP160R1,
        ROM_CURVE_SM2: ROM_CURVE_SM2,
        ROM_CURVE_C13318: ROM_CURVE_C13318,
        ROM_CURVE_JUBJUB: ROM_CURVE_JUBJUB,
	ROM_CURVE_TWEEDLEDEE: ROM_CURVE_TWEEDLEDEE,
	ROM_CURVE_TWEEDLEDUM: ROM_CURVE_TWEEDLEDUM
    };
}

